首先,我很抱歉我的成绩这么差,大家好,我是 laravel 的新手,我刚刚在学习 laravel。我有 link_to_route() 函数的问题错误我尝试修复并搜索谷歌但我仍然不能。我得到了错误:
Whoops, looks like something went wrong.
1/1 FatalErrorException in cb4e66236ac7f3bb7bc9c7abce945dc30f4b8bf1.php line 33: Call to undefined function link_to_route()
这是我的 route.php
Route::group(['prefix'=>'auth'], function(){
Route::get('register',[
'as' => 'get_register',
'uses' => 'Auth\AuthController@getRegister'
]);
Route::post('register',[
'as' => 'post_register',
'uses' => 'Auth\AuthController@postRegister'
]);
});
这是我的代码 nav.blade.php
<li><?php echo link_to_route('get_register', 'Register'); ?></li>
最佳答案
您需要安装一个名为 "laravelcollective/html": "~5.0"
在你的 composer.json 文件中,写下这一行
"laravelcollective/html": "~5.0"
然后打开config/app.php
文件。
在提供者数组中,写下这一行:-
'Collective\Html\HtmlServiceProvider',
接下来,将这些行添加到“别名”数组中:
'Form' => 'Collective\Html\FormFacade',
'Html' => 'Collective\Html\HtmlFacade',
这link会帮助你。
关于php - 如何修复对未定义函数 link_to_route() laravel 5 的错误调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34613167/