Home >Backend Development >PHP Tutorial >owncloud source code analysis 9--scattered content
1. Add routing to the root directory
The location is:
libprivaterouterouter.php line 145,
For example:
First add a line to line 145 of the above file:
<span>//测试 </span><span><strong>require</strong>_once </span><span>'test/routes.php'</span><span>;</span>
Then add a test root directory, Then add the routing file routes.php in the root directory, the content is as follows:
<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>
Finally, add a test.php file in the test folder, the content is as follows:
<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>Then you can pass the address: http:// sunny.ownclouddemo.com/index.php/test/test accesses this test.php file, which is displayed as follows:
At this point, the folder has been added to the root directory and can be accessed.
To be continued. . .
The above introduces the scattered content of owncloud source code analysis 9, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.