Laravel 为什么在illumb\support\facade\input中找不到方法post

Laravel 为什么在illumb\support\facade\input中找不到方法post,laravel,input,laravel-5.3,Laravel,Input,Laravel 5.3,我使用的是laravael 5.3.9。 在我的控制器中,我使用 light\Support\Facades\Input 但当我尝试使用方法post从用户表单获取输入时,如下所示: function add(){ $fullName = Input::post('fullName' , 'test'); 我得到这个错误 输入类的唯一方法是“get”。 我不希望在我的系统中使用方法post,delete,put…我想,Input::post方法不用于L5.3。使用Request faca

我使用的是
laravael 5.3.9
。 在我的控制器中,我使用

light\Support\Facades\Input

但当我尝试使用方法post从用户表单获取输入时,如下所示:

function add(){
    $fullName = Input::post('fullName' , 'test');
我得到这个错误

输入类的唯一方法是“get”。


我不希望在我的系统中使用方法
post
delete
put

我想,
Input::post
方法不用于L5.3。使用Request facade或
$Request
获取输入变量

在你的控制器里试试这个

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

class area_owners extends Controller 
{ 
    function add(Request $request)
    { 
        // I assume all these input variable have same name in you FORM.
        $fullName = $request->input('fullName'); 
        $smsCode  = $request->input('smsCode');
        $authorizationId =  $request->input('authorizationId');
        $areaNumber‌​ =  $request->input('areaNumber‌​');
        $neigh_project_Id =  $request->input('neigh_project_Id');

        $area_owners = DB::table('area_owners')
            ->insert(['fullName'=>$fullName,
                    'smsCode'=>$smsCode,
                    'authorizationId'=>$authorizationId,
                    'are‌​aNumer'=>$areaNumber‌​,
                    'neigh_project_Id'=‌​>$neigh_project_Id])‌​; 
    return view('area_owners_add', ['area_owners' => $area_owners]); 
    } 
} 

如果有帮助,请告诉我。

我想,
Input::post
方法不用于L5.3。使用Request facade或
$Request
获取输入变量

在你的控制器里试试这个

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

class area_owners extends Controller 
{ 
    function add(Request $request)
    { 
        // I assume all these input variable have same name in you FORM.
        $fullName = $request->input('fullName'); 
        $smsCode  = $request->input('smsCode');
        $authorizationId =  $request->input('authorizationId');
        $areaNumber‌​ =  $request->input('areaNumber‌​');
        $neigh_project_Id =  $request->input('neigh_project_Id');

        $area_owners = DB::table('area_owners')
            ->insert(['fullName'=>$fullName,
                    'smsCode'=>$smsCode,
                    'authorizationId'=>$authorizationId,
                    'are‌​aNumer'=>$areaNumber‌​,
                    'neigh_project_Id'=‌​>$neigh_project_Id])‌​; 
    return view('area_owners_add', ['area_owners' => $area_owners]); 
    } 
} 

如果有帮助,请告诉我。

您在
route.php
文件中定义了什么。你在那里定好路线了吗?。在您添加的函数中,您错过了结束括号,或者它在这里的类型错误!?将代码放在这里可以更好地了解错误。routes/web.php文件中的相关命令是:Route::match(['get','post'],'area\u owners/add','area_owners@add'); 控制器中的相关代码是:function add(){$fullName=Input::post('fullName');}请在控制器中尝试下面的代码,并告诉我<代码>输入::不使用post
,而是使用
请求facade
。您在
route.php
文件中定义了什么。你在那里定好路线了吗?。在您添加的函数中,您错过了结束括号,或者它在这里的类型错误!?将代码放在这里可以更好地了解错误。routes/web.php文件中的相关命令是:Route::match(['get','post'],'area\u owners/add','area_owners@add'); 控制器中的相关代码是:function add(){$fullName=Input::post('fullName');}请在控制器中尝试下面的代码,并告诉我<代码>输入::未使用post,而是使用
请求外观
。是的,它部分工作。。。表单已提交,行已添加到表中,但它与GET方法完全相同,因为所有参数都显示在url中:我不希望这样,您发布
表单的方法是什么。在
视图文件中,检查表单标记<代码>表单的方法是什么。在
视图文件中,检查表单标记<代码>