Refer to the examples in this article to analyze the common thinkphp path usage. Share it with you for your reference. The details are as follows:
The labels described here mainly include: _ root _ self _ action _ url _ app _ public __
Assume that the Homepage URL of your project is www.test.com/other/Form.
If the current module is: Index
If the current operation is: index
Then the home page complete URL: http://www.test.com/other/Form/index.php/Index/index
1:/other/thinkphp/mydemo
Php-weizijiaocheng-54555.html:/other/thinkphp/mydemo/Form/index. php
3/index. php/Article/detail:/other/thinkphp/mydemo/Form/index. php/Index/index
4/index. php/Article:/other/thinkphp/mydemo/Form/index. php/Index
5/index. php:/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 path operations in the template are as follows:
The code is as follows:
// Project Public Directory
$ TmplContent = str_ireplace ('../public', APP_PUBLIC_URL, $ tmplContent );
// Public website directory
$ TmplContent = str_replace ('/public', WEB_PUBLIC_URL, $ tmplContent );
// Website root directory
$ TmplContent = str_replace ('', $ tmplContent );
// Current project address
$ TmplContent = str_replace ('/index. php',/index. php, $ tmplContent );
// Address of the current module
$ TmplContent = str_replace ('/index. php/article',/index. php/Article, $ tmplContent );
// Operation address of the current project
$ TmplContent = str_replace ('/index. php/Article/detail',/index. php/Article/detail, $ tmplContent );
// Operation address on the current page
$ TmplContent = str_replace ('/php-weizijiaocheng-54555.html',/php-weizijiaocheng-54555.html, $ tmplContent );
I hope this article will help you design PHP programs based on the ThinkPHP framework.