国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開發(fā) > PHP > 正文

ThinkPHP、ZF2、Yaf、Laravel框架路由大比拼

2024-05-04 23:33:23
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
這篇文章主要介紹了ThinkPHP、ZF2、Yaf、Laravel框架路由大比拼的相關(guān)資料,需要的朋友可以參考下
 

前言

讀過一篇關(guān)于Zend Framework2的技術(shù)文章《ZF2多級(jí)樹形路由Route配置實(shí)例》,是介紹路由配置的。我覺得很有意思,這是的需求:

/user對(duì)應(yīng)用戶列表頁(yè)面
/user/:user_id對(duì)應(yīng)用戶的個(gè)人主頁(yè),比如 /user/AlloVince 就對(duì)應(yīng)AlloVince用戶的個(gè)人主頁(yè)
/user/:user_id/blog/對(duì)應(yīng)用戶的博客列表頁(yè)面,比如 /user/AlloVince/blog 就會(huì)列出AlloVince寫過的Blog
/user/:user_id/blog/:blog_id對(duì)應(yīng)用戶的一篇博客文章
方案引用自原文:
 

  1. 'router' => array
  2.   'routes' => array
  3.     'user' => array
  4.       'type' => 'Segment'
  5.       'options' => array
  6.         'route' => '/user[/]'
  7.         'defaults' => array
  8.           'controller' => 'UserController'
  9.           'action' => 'index'
  10.         ), 
  11.       ), 
  12.       'may_terminate' => true, 
  13.       'child_routes' => array
  14.         'profile' => array
  15.           'type' => 'Segment'
  16.           'options' => array
  17.             'route' => '[:id][/]'
  18.             'constraints' => array
  19.               'id' => '[a-zA-Z0-9_-]+' 
  20.             ), 
  21.             'defaults' => array
  22.               'action' => 'get' 
  23.             ), 
  24.           ), 
  25.           'may_terminate' => true, 
  26.           'child_routes' => array
  27.             'blog' => array
  28.               'type' => 'Segment'
  29.               'options' => array
  30.                 'route' => 'blog[/]'
  31.                 'constraints' => array
  32.                 ), 
  33.                 'defaults' => array
  34.                   'action' => 'blog' 
  35.                 ) 
  36.               ), 
  37.               'may_terminate' => true, 
  38.               'child_routes' => array
  39.                 'post' => array
  40.                   'type' => 'Segment'
  41.                   'options' => array
  42.                     'route' => '[:post_id][/]'
  43.                     'constraints' => array
  44.                       'post_id' => '[a-zA-Z0-9_-]+' 
  45.                     ), 
  46.                     'defaults' => array
  47.                       'action' => 'post' 
  48.                     ) 
  49.                   ), 
  50.                   'may_terminate' => true, 
  51.                 ), 
  52.               ), 
  53.             ), 
  54.           ), //profile child_routes end 
  55.         ), //profile end 
  56.       ), //user child_routes end 
  57.     ), //user end 
  58.   ), 
  59. ), 
?
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 探索| 简阳市| 颍上县| 睢宁县| 德阳市| 东至县| 定结县| 昌黎县| 青田县| 张北县| 喀喇沁旗| 上高县| 临沂市| 泗水县| 泌阳县| 遂平县| 牡丹江市| 通江县| 新民市| 江华| 鄯善县| 瑞昌市| 班戈县| 萍乡市| 邓州市| 互助| 阿巴嘎旗| 伊春市| 易门县| 保亭| 福泉市| 竹北市| 天峻县| 萨迦县| 枞阳县| 北辰区| 民和| 道真| 都兰县| 汉阴县| 阿城市|