私はAjaxを使用してPOSTを実行しています。私のサーバーはデータを正常に取得しています。しかし、私はユーザーが送信した値にアクセスするのに苦労しています。簡単な言葉で "user"(tom)の値にどのようにアクセスできますか?誰でも私を正しい道に乗せてください。前もって感謝します。ここに私のJsonResponseオブジェクトがあります:PHPまたはLaravelのJsonResponseオブジェクト内のプロパティ値にアクセスするには?
[2016-10-22 05:10:49] local.INFO: From Ajax: Illuminate\Http\JsonResponse Object
(
[data:protected] => {"user":"Tom","_token":"uRZJBVHH3worhjX4Ul6WlnJC1JYh3EVMNWob7Azr"}
[callback:protected] =>
[encodingOptions:protected] => 0
[headers] => Symfony\Component\HttpFoundation\ResponseHeaderBag Object
(
[computedCacheControl:protected] => Array
(
[no-cache] => 1
)
[cookies:protected] => Array
(
)
[headerNames:protected] => Array
(
[cache-control] => Cache-Control
[content-type] => Content-Type
)
[headers:protected] => Array
(
[cache-control] => Array
(
[0] => no-cache
)
[content-type] => Array
(
[0] => application/json
)
)
[cacheControl:protected] => Array
(
)
)
[content:protected] => {"user":"Tom","_token":"uRZJBVHH3worhjX4Ul6WlnJC1JYh3EVMNWob7Azr"}
[version:protected] => 1.0
[statusCode:protected] => 200
[statusText:protected] => OK
[charset:protected] =>
)
これは私が私のサーバーで取得JsonObjectには適用されません。私はユーザーの価値にアクセスする方法を見つける必要があります。 – HenryDev
@HenryDev Hmm .. 'content()'メソッドはどうでしょうか? https://laravel.com/api/5.3/Illuminate/Http/JsonResponse.html – aleksejjj