Rumah >pembangunan bahagian belakang >tutorial php >owncloud源码分析9--零散的内容
1、根目录加入路由
位置在:
\lib\private\route\router.php的145行,
例如:
先在上面文件的145行加入一行:
<span>//测试 </span><span><strong>require</strong>_once </span><span>'test/routes.php'</span><span>;</span>
然后加入一个test的根目录,然后再在根目录下加入路由文件routes.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>
最后再加入到test文件夹中一个test.php的文件,内容如下:
<span><?php </span><span><em>/** </em></span><span><em> * Created by PhpStorm. </em></span><span><em> * User: sunny </em></span><span><em> * Date: 2015/9/18 </em></span><span><em> * Time: 16:18 </em></span><span><em> */ </em></span><span>echo </span><span>"哈哈哈哈"</span><span>;</span></span>那么便可以通过地址:http://sunny.ownclouddemo.com/index.php/test/test访问到这个test.php文件,显示如下:
至此就完成了根目录下加入文件夹并能访问的情况。
待继续。。。
以上就介绍了owncloud源码分析9--零散的内容,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。