Home > Backend Development > PHP Tutorial > Laravel中URL,ACTION,ROUTE区别

Laravel中URL,ACTION,ROUTE区别

WBOY
Release: 2016-06-23 13:29:36
Original
1494 people have browsed it

创建路由如下所示:
Route::get('articles',['uses'=>'ArticlesController@index','as'=>'articles.index']);
Copy after login

要访问该URL可以通过如下形式:

  • URL方式
  • <a href="%7B%7B%20url('/articles')%20%7D%7D">链接</a><a href="%7B%7B%20URL::to('/articles')%20%7D%7D">链接</a>
    Copy after login


  • Route方式
  • <a href="%7B%7B%20URL::route('articles.index')%20%7D%7D">链接</a><a href="%7B%7B%20route('articles.index')%20%7D%7D">链接</a>
    Copy after login


  • Action方式
  • <a href="%7B%7B%20URL::action('ArticlesController@index')%20%7D%7D">链接</a><a href="%7B%7B%20action('ArticlesController@index')%20%7D%7D">链接</a>
    Copy after login


    所以在路由配置中,每个参数的代表意义为:






    版权声明:本文为博主原创文章,未经博主允许不得转载。

    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template