Php 如何在Laravel中设置正确的URL?
我使用Laravel 5,并具有以下路由配置:Php 如何在Laravel中设置正确的URL?,php,laravel,laravel-5,Php,Laravel,Laravel 5,我使用Laravel 5,并具有以下路由配置: $router->resource('restaurants', 'Registration'); 方法: public function store(Auth $userModel, Request $request){ }); 在我的视图文件中,我指定了如下表单: {!! Form::open(array('url' => 'restaurants.store')) !!} 当我提交表格时,我被转移到地址:餐厅。商店,并获得错
$router->resource('restaurants', 'Registration');
方法:
public function store(Auth $userModel, Request $request){
});
在我的视图文件中,我指定了如下表单:
{!! Form::open(array('url' => 'restaurants.store')) !!}
当我提交表格时,我被转移到地址:餐厅。商店
,并获得错误:
很抱歉,找不到您正在查找的页面。您可以使用url语法,该语法需要斜杠,如下所示:
{!! Form::open(array('url' => route('restaurants.store'))) !!}
{!! Form::open(array('url' => 'restaurants/store')) !!}
或者路由语法(如果已设置路由),如下所示:
您可以使用需要斜杠的url语法,如下所示:
{!! Form::open(array('url' => 'restaurants/store')) !!}
或者路由语法(如果已设置路由),如下所示:
更改
{!!Form::open(array('url'=>'restaurants.store'))!!}
使用{!!Form::open(array('route'=>'restaurants.store'))!!}
并且因为您使用restful,所以在routes.php$router->resource('restaurants',restaurantsconner')
更改{!!Form::open(array('url'=>'restaurants.store'))!!}
使用{!!Form::open(array('route'=>'restaurants.store'))!!}
并且因为您使用restful,所以在routes.php$router->resource('restaurants',restaurantsconner')代码>