thinkphp Common path usage analysis, thinkphp path usage
This paper analyzes the common path usage of thinkphp. Share to everyone for your reference. Specific as follows:
The labels introduced here mainly include: __root__ __self__ __action__ __url__ __app__ __public__
If the URL of your project home page is: www.test.com/other/Form
If the current module is: Index
If the current operation is: Index
So the home full Url:http://www.test.com/other/form/index.php/index/index
1 __root__:/other/thinkphp/mydemo
2 __self__:/other/thinkphp/mydemo/form/index.php
3 __action__:/other/thinkphp/mydemo/form/index.php/index/index
4 __url__:/other/thinkphp/mydemo/form/index.php/index
5 __app__:/other/thinkphp/mydemo/form/index.php
6 __public__:/other/thinkphp/mydemo/public
7.. /public (case insensitive):/other/thinkphp/mydemo/form/tpl/default/public
8 App_public_url:/other/thinkphp/mydemo/form/tpl/default/public
9 Web_public_url:/other/thinkphp/mydemo/public
The actions on the Path section in the template are as follows:
Copy the Code Code as follows://Project Public directory
$tmplContent = Str_ireplace ('.. /public ', App_public_url, $tmplContent);
Site Public Directory
$tmplContent = Str_replace (' __public__ ', Web_public_url, $tmplContent);
Site root directory
$tmplContent = Str_replace (' __root__ ', __root__, $tmplContent);
Current project Address
$tmplContent = Str_replace (' __app__ ', __app__, $tmplContent);
Current module Address
$tmplContent = Str_replace (' __url__ ', __url__, $tmplContent);
Current Project Action Address
$tmplContent = Str_replace (' __action__ ', __action__, $tmplContent);
Current Page Action Address
$tmplContent = Str_replace (' __self__ ', __self__, $tmplContent);
It is hoped that this article is helpful to the PHP program design based on thinkphp framework.
http://www.bkjia.com/PHPjc/920603.html www.bkjia.com true http://www.bkjia.com/PHPjc/920603.html techarticle thinkphp Common path usage analysis, thinkphp path usage This article has analyzed thinkphp common path usage. Share to everyone for your reference. As follows: The label introduced here is mainly ...