通过 "POST" 方法从表单向控制器发送数据的问题。 print_r($request) 在控制器中显示而不是提供的数据
problem from sending data from form via "POST" method to the controller. print_r($request) in controller shows up instead of the data provided
在 laravel
中的 print_f($request) 之后控制器中出现这样的错误
Illuminate\Http\Request Object
(
[json:protected] =>
[convertedFiles:protected] =>
[userResolver:protected] => Closure Object
(
[static] => Array
(
[app] => Illuminate\Foundation\Application Object
(
[basePath:protected] => /Users/kunalgautam/Sites/resume_site
[hasBeenBootstrapped:protected] => 1
[booted:protected] => 1
[bootingCallbacks:protected] => Array
(
[0] => Closure Object
(
[static] => Array
(
[instance] => Illuminate\Queue\QueueServiceProvider Object
(
[app:protected] => Illuminate\Foundation\Application Object
*RECURSION*
)
)
[this] => Illuminate\Foundation\Application Object
*RECURSION*
)
)
[bootedCallbacks:protected] => Array
(
[0] => Closure Object
(
[this] => App\Providers\RouteServiceProvider Object
(
[namespace:protected] => App\Http\Controllers
[app:protected] => Illuminate\Foundation\Application Object
*RECURSION*
)
)
)
[terminatingCallbacks:protected] => Array
(
)
[serviceProviders:protected] => Array
(
[0] => Illuminate\Events\EventServiceProvider Object
(
[app:protected] => Illuminate\Foundation\Application Object
*RECURSION*
这不是错误,它正是 $request
中的内容。 $request
是 Illuminate\Http\Request
的 object,其中包含许多关于您的 header 的信息,例如 pathInfo、requestUri、DOCUMENT_ROOT、REMOTE_ADDR 和许多其他参数,以及职能。如果您想查看 $_post
数据,请执行以下操作:
print_r($request->all())
在 laravel
中的 print_f($request) 之后控制器中出现这样的错误 Illuminate\Http\Request Object
(
[json:protected] =>
[convertedFiles:protected] =>
[userResolver:protected] => Closure Object
(
[static] => Array
(
[app] => Illuminate\Foundation\Application Object
(
[basePath:protected] => /Users/kunalgautam/Sites/resume_site
[hasBeenBootstrapped:protected] => 1
[booted:protected] => 1
[bootingCallbacks:protected] => Array
(
[0] => Closure Object
(
[static] => Array
(
[instance] => Illuminate\Queue\QueueServiceProvider Object
(
[app:protected] => Illuminate\Foundation\Application Object
*RECURSION*
)
)
[this] => Illuminate\Foundation\Application Object
*RECURSION*
)
)
[bootedCallbacks:protected] => Array
(
[0] => Closure Object
(
[this] => App\Providers\RouteServiceProvider Object
(
[namespace:protected] => App\Http\Controllers
[app:protected] => Illuminate\Foundation\Application Object
*RECURSION*
)
)
)
[terminatingCallbacks:protected] => Array
(
)
[serviceProviders:protected] => Array
(
[0] => Illuminate\Events\EventServiceProvider Object
(
[app:protected] => Illuminate\Foundation\Application Object
*RECURSION*
这不是错误,它正是 $request
中的内容。 $request
是 Illuminate\Http\Request
的 object,其中包含许多关于您的 header 的信息,例如 pathInfo、requestUri、DOCUMENT_ROOT、REMOTE_ADDR 和许多其他参数,以及职能。如果您想查看 $_post
数据,请执行以下操作:
print_r($request->all())