Search code examples
phplaravelpostphp-ini

problem from sending data from form via "POST" method to the controller. print_r($request) in controller shows up instead of the data provided


Error shows up as such in the controller after print_f($request) in laravel

   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*

Solution

  • it is not an error it is exactly what is inside $request. $request is an object of Illuminate\Http\Request that contains many information about your header like pathInfo,requestUri,DOCUMENT_ROOT,REMOTE_ADDR and many other parameters and functions. if you want to see $_post data just do this:

    print_r($request->all())