Laravel 4: Input::get() is not working

后端 未结 3 901
故里飘歌
故里飘歌 2021-01-23 09:42

Something weird is happening in my production server using CentOS 7 and the problem is... in my local environment I have many applications developed with Laravel 4 and were inst

3条回答
  •  时光说笑
    2021-01-23 10:05

    I just did a test locally using the following settings:

    // routes.php
    Route::get("/test", "AppController@test");
    
    // AppController.php
    public function test() { 
      print_r(Input::get("test"));
      return View::make("test");
    }
    
    // test.blade.php
    

    After pressing Submit, the url changes to localhost/sotests/test?s=test and the page returns with "test" printed right above the form.

    Some changes, I used URL::to("test") as my action. I don't know if that will fix your issue, but it worked like a charm for me. Other than that, I also didn't use Laravel's Form class, but I don't think that would make a difference.

    Let me know if this works for you!

提交回复
热议问题