Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.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/9/visual-studio/7.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 ';as';route::controller-Laravel 5.2中的参数_Php_Laravel - Fatal编程技术网

Php ';as';route::controller-Laravel 5.2中的参数

Php ';as';route::controller-Laravel 5.2中的参数,php,laravel,Php,Laravel,在我的应用程序中,我使用以下路线: Route::get('router', ['as' => 'router.index', 'uses' => 'RouterController@index']); 为了使用数据表,必须以不同的方式定义路由 Route::controller('router', 'RouterController', [ 'dataTablesData' => 'datatables.data', 'index' => 'route

在我的应用程序中,我使用以下路线:

Route::get('router', ['as' => 'router.index', 'uses' => 'RouterController@index']);
为了使用
数据表
,必须以不同的方式定义路由

Route::controller('router', 'RouterController', [
    'dataTablesData' => 'datatables.data',
    'index' => 'router',
    ]);
这会导致我的应用程序由于缺少
'as'=>“router.index'
而崩溃。在
Route::controller
中,应将
作为
参数放置在何处

Route::controller(
    'router',
    'RouterController',
    array(
        'index'     => 'router.index',
    )
);

尝试类似的方法?

数组键
,因为它不是必需的,所以不会使应用程序崩溃。你能告诉我们错误吗?您可能正在应用程序中的某个地方使用
router.index
,但它已经不存在了。我得到的错误是:
调用来自侧边栏菜单的null
上的成员函数getName()。此代码使用了
isRouteIn
,这导致了错误。此外,我在发生错误的代码中定义了:
route('router.index')
。我需要缺少的
datatabledata
参数,添加此参数使代码与我的代码完全相同。