你好我们得到Route [member.store]没有定义。我的laravel 5.5应用程序中的错误 ****这是create.blade.php ****
<form class="form-horizontal" method="POST" action="{{ route ('member.store') }}">
{{ csrf_field() }}
<div class="control-group">
<label class="control-label">First Name</label>
<div class="controls">
<input type="text" name="first_name" id="required">
</div>
</div>
<div class="control-group">
<label class="control-label">Middle Name</label>
<div class="controls">
<input type="text" name="middle_name" id="required">
</div>
</div>
<div class="control-group">
<label class="control-label">Last Name</label>
<div class="controls">
<input type="text" name="last_name" id="required">
</div>
</div>
<div class="control-group">
<label class="control-label">Gender</label>
<div class="controls" name="gender">
<select >
<option>Unknown</option>
<option>Male</option>
<option>Female</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">Marital Status</label>
<div class="controls" name="marital_status">
<select >
<option>Unknown</option>
<option>Single</option>
<option>Engaged</option>
<option>Married</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">Status</label>
<div class="controls">
<select >
<option>Unknown</option>
<option>Attender</option>
<option>Visitor</option>
<option>Inactive</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">Mobile Phone</label>
<div class="controls">
<input type="text" name="required" id="required">
</div>
</div>
<div class="control-group">
<label class="control-label">Your Email</label>
<div class="controls">
<input type="text" name="email" id="email">
</div>
</div>
<div class="control-group">
<label class="control-label">Date of Birth</label>
<div class="controls">
<input type="text" name="date" id="date">
</div>
</div>
<div class="control-group">
<label class="control-label">Address</label>
<div class="controls">
<input type="text" name="email" id="email">
</div>
</div>
<div class="control-group">
<label class="control-label">Photo</label>
<div class="controls">
<input type="upload" name="photo" id="email">
</div>
</div>
<div class="control-group">
<label class="control-label">Description</label>
<div class="controls">
<input type="text" name="description" id="email">
</div>
</div>
<div class="form-actions">
<input type="submit" name="submit" class="btn btn-success">
</div>
</form>
这是路线 //会员路线 Route :: group(['prefix'=&gt;'member'],function(){
Route::post('store', 'MemberController@store');
Route::get('data', 'MemberController@index');
Route::get('create', 'MemberController@create');
}); 这是membercontroller
命名空间App \ Http \ Controllers;
使用App \ Member; 使用Illuminate \ Http \ Request;
类MemberController扩展Controller {
public function index()
{
return view ('member.data');
}
public function create()
{
return view ('member.create');
}
public function store(Request $request)
{
return $request->all();
}
public function show($id)
{
//
}
public function edit($id)
{
//
}
public function update(Request $request, $id)
{
//
}
public function destroy($id)
{
//
}
} PLease家伙真的需要你的帮助
答案 0 :(得分:0)
有两种方法可以做到这一点:一种是将路由声明为资源:
Route::resource("member", "MemberController");
或者:
Route::post('store', 'MemberController@store')->name("member.store");
第一个自动获取名称,如&#34; member.store&#34;,&#34; member.index&#34;等。 第二个是您在routes.php之前声明的名称。