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

Laravel中URL,ACTION,ROUTE区别

WBOY
WBOYOriginal
2016-06-23 13:29:361476browse

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

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

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


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


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


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






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

    Statement:
    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