小白兔晒黑了

导航

 

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

1 路由设置   \routes\web.php

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

2 添加action \app\Http\Controllers\StudentController.php

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

 

3 添加url链接  \resources\views\student\section1.blade.php

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

页面显示

三个链接跳转到同一个action

posted on 2020-07-14 20:33  小白兔晒黑了  阅读(504)  评论(0编辑  收藏  举报