簡體   English   中英

如何修復錯誤調用未定義的函數link_to_route()laravel 5?

[英]How to fix error Call to undefined function link_to_route() laravel 5?

首先,我很抱歉,我的結局如此糟糕,嗨,我只是一個新的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"的包"laravelcollective/html": "~5.0"

在您的composer.json文件中,寫下此行

“laravelcollective / html”:“~5.0”

然后打開config/app.php文件。

在提供者數組中,寫下這一行: -

'集體\\ HTML \\ HtmlServiceProvider',

接下來,將這些行添加到'aliases'數組中:

'Form'=>'Collective \\ Html \\ FormFacade',

'Html'=>'Collective \\ Html \\ HtmlFacade',

鏈接將幫助您。

在將“laravelcollective / html”:“~5.0”行添加到composer.json文件后,不要忘記更新作曲家。 請使用以下參考站點https://laravelcollective.com/docs/5.0/html#installation獲取更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM