路由
路由
路由文件位于根目录 route.php
,如 blog
模块
return [
'blog' => [
'api/test1' => 'api/Index@test1', // blog/controller/api/Index类test1方法
],
'blog/api/test2' => 'api/Index@test2' // blog/controller/api/Index类 test2方法
];
<h3 id="h3-u8DEFu7531"><a name="路由" class="reference-link"></a><span class="header-link octicon octicon-link"></span>路由</h3><p>路由文件位于根目录 <code>route.php</code>,如 <code>blog</code> 模块</p>
<pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code><span class="kwd">return</span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L1"><code><span class="pln"> </span><span class="str">'blog'</span><span class="pln"> </span><span class="pun">=></span><span class="pln"> </span><span class="pun">[</span></code></li><li class="L2"><code><span class="pln"> </span><span class="str">'api/test1'</span><span class="pln"> </span><span class="pun">=></span><span class="pln"> </span><span class="str">'api/Index@test1'</span><span class="pun">,</span><span class="pln"> </span><span class="com">// blog/controller/api/Index类test1方法</span></code></li><li class="L3"><code><span class="pln"> </span><span class="pun">],</span></code></li><li class="L4"><code><span class="pln"> </span><span class="str">'blog/api/test2'</span><span class="pln"> </span><span class="pun">=></span><span class="pln"> </span><span class="str">'api/Index@test2'</span><span class="pln"> </span><span class="com">// blog/controller/api/Index类 test2方法</span></code></li><li class="L5"><code><span class="pun">];</span></code></li></ol></pre>