1、根目錄加入路由
位置在:
libprivaterouterouter.php的145行,
例如:
先在上面檔案的145行加入一行:
然後再在根目錄下加入路由文件routes.php,內容如下:<span>//测试 </span><span><strong>require</strong>_once </span><span>'test/routes.php'</span><span>;</span>最後再加入到test資料夾中一個test.php的文件,內容如下:
<span><?php </span><span><em>/** </em></span><span><em> * Copyright (c) 2012 Bart Visscher </em></span><span><em>bartv@thisnet.nl</em></span><span><em>> </em></span><span><em> * This file is licensed under the Affero General Public License version 3 or </em></span><span><em> * later. </em></span><span><em> * See the COPYING-README file. </em></span><span><em> */ </em></span><span><em></em></span><span>namespace </span><span>OC\Test</span><span>; </span><span></span><span>$this</span><span>-></span><span>create</span><span>(</span><span>'test_test'</span><span>, </span><span>'test/test'</span><span>) </span><span> -></span><span>actionInclude</span><span>(</span><span>'test/test.php'</span><span>)</span><span>;</span></span>那麼便可以透過位址:http:// sunny.ownclouddemo.com/index.php/test/test訪問到這個test.php文件,顯示如下: