php - 如何修复对未定义函数 link_to_route() laravel 5 的错误调用?

标签 php laravel-4 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"

的包

在你的 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/

相关文章:

php - Phalcon 模型无法识别 AUTO_INCRMENT 表列

laravel - laravel schema builder 中 json 字段类型的目的和实现

php - 拉维尔 : Overriding a Bundle's Service Providers

javascript - 无法使用jquery交换复选框上按钮的属性

php - 如何在 Laravel 中使用旧输入进行重定向?

php - 得到????标记为来自 php 的响应,而不是获取泰米尔文本字符串。

javascript - 使用 PHP 登录和 OAuth2

php - Symfony2 : how to get all entities of one type which are marked with "EDIT" ACL permission?

php - jason lewis basset 在 laravel 4 中没有很好地显示图标

php - 使用 Select2 的 Laravel 5,使用 ajax 加载数据