Laravel 中的模板中的url

三个方法:url() 、action()、route() 都可以跳转

1 路由设置   outesweb.php

Route::any('url',['as'=>'url','uses'=>'StudentController@urlTest']);

2 添加action appHttpControllersStudentController.php

    public function urlTest()
    {
        return 'urlTest';
    }

3 添加url链接  esourcesviewsstudentsection1.blade.php

    <a href="{{ url('url') }}">使用url()</a>
    <br>
    <a href="{{ action('StudentController@urlTest') }}">
        使用action()
    </a>
    <br>
    <a href="{{ route('url') }}">
        使用route()
    </a>

页面显示

三个链接跳转到同一个action

原文地址:https://www.cnblogs.com/polax/p/13301462.html