Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将数据从窗体传递到控制器Laravel 5_Php_Laravel_Laravel 5 - Fatal编程技术网

Php 将数据从窗体传递到控制器Laravel 5

Php 将数据从窗体传递到控制器Laravel 5,php,laravel,laravel-5,Php,Laravel,Laravel 5,我正在尝试使用restful控制器在Laravel5应用程序中注册用户 问题是,当我在store函数中转储数据时,我只获得csrf令牌,而不获取值 以下是我迄今为止所做的尝试: Input::all() Request::get() 以下是我正在执行的代码: 表格 <form class="form-horizontal" method="post" action="/users"> <div class="form-group"> <label fo

我正在尝试使用restful控制器在Laravel5应用程序中注册用户

问题是,当我在store函数中转储数据时,我只获得csrf令牌,而不获取值

以下是我迄今为止所做的尝试:

  • Input::all()
  • Request::get()
以下是我正在执行的代码:

表格

<form class="form-horizontal" method="post" action="/users">

<div class="form-group">
    <label for="name" class="col-lg-2 control-label">
        Name
    </label>
    <div class="col-lg-10">
        <input type="text" class="form-control" id="name" value="a">
    </div>
</div>
<div class="form-group">
    <label for="email" class="col-lg-2 control-label">
        Email
    </label>
    <div class="col-lg-10">
        <input type="email" class="form-control" id="email" value="a@a.Fr">
    </div>
</div>
<div class="form-group">
    <label for="password" class="col-lg-2 control-label">
        Pw
    </label>
    <div class="col-lg-10">
        <input type="password" class="form-control" id="password">
    </div>
</div>
<div class="form-group">
    <div class="col-lg-10 col-lg-offset-2">
        <button type="reset" class="btn btn-default">Cancel</button>
        <button type="submit" class="btn btn-primary">Create</button>

    </div>
</div>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
</form>
而路线只是

Route::resource('users','UsersController');

您的输入字段都缺少
名称
属性!比如说

<input type="text" class="form-control" id="name" name="name" value="a">
<!--                                              ^^^^^^^^^^^        -->

您应该在输入字段中添加
name
属性,因为html表单使用
name
属性与php进行通信

例如:

<input........... name="etc">

已经编写了10年了,我也忘了,哈哈哈;)刚来到这篇文章,遇到了完全相同的问题-哎呀。。。谢谢
<input........... name="etc">
 $user->name = $input['etc'];