thinkphp path (pure turn)

Source: Internet
Author: User
Tags vars

TP has a lot of convenient use of the path, such as the template used in the __url__,__action__, and so on, if you are not very clear about these paths, use it may have such or that the problem, or out of the wrong also do not know how to change, now we look at what these paths represent what it is!
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
__root__:/other/thinkphp/mydemo
__self__:/other/thinkphp/mydemo/form/index.php
__ACTION__:/other/thinkphp/mydemo/form/index.php/index/index
__URL__:/other/thinkphp/mydemo/form/index.php/index
__APP__:/other/thinkphp/mydemo/form/index.php
__public__:/other/thinkphp/mydemo/public
.. /public(case insensitive):/other/thinkphp/mydemo/form/tpl/default/public
App_public_url:/other/thinkphp/mydemo/form/tpl/default/public
Web_public_url:/other/thinkphp/mydemo/public

The actions on the Path section in the template are as follows:

PHP code
  1. Project Public Directory
  2. $tmplContent = str_ireplace ('..  /public ', App_public_url,$tmplContent);
  3. //Website Public directory
  4. $tmplContent = str_replace (' __public__ ', Web_public_url,$tmplContent);
  5. //Website root directory
  6. $tmplContent = str_replace (' __root__ ', __root__,$tmplContent);
  7. //Current project address
  8. $tmplContent = str_replace (' __app__ ', __app__,$tmplContent);
  9. //Current module address
  10. $tmplContent = str_replace (' __url__ ', __url__,$tmplContent);
  11. //Current project operation address
  12. $tmplContent = str_replace (' __action__ ', __action__,$tmplContent);
  13. //Current page operation address
  14. $tmplContent = str_replace (' __self__ ', __self__,$tmplContent);

<!---------------------------------------------------------------------------------------------------------- ------->

Think_path//thinkphp system directory
App_path//Current project directory
App_name//Current project name
Module_name//Current module name
Action_name//Current operation name
Tmpl_path//project template Catalog
Lib_path//Project Class Library Directory
Cache_path//project Template Cache Directory
Config_path//project configuration file directory
Log_path//project log file directory
Lang_path//Project Language file directory
Temp_path//Project temp file directory
Plugin_path//project plug-in file directory
Vendor_path//third-party class library Directory
Data_path//Project data file directory
Is_apache//Whether it belongs to APACHE
Is_iis//Whether it belongs to IIS
Is_win//Whether it belongs to the Windows environment
Is_linux//Whether it belongs to LINUX environment
IS_FREEBSD//Whether it belongs to FREEBSD environment
Now_time//Current timestamp
MEMORY_LIMIT_ON//Whether there is a memory usage limit
OUTPUT_GZIP_ON//whether to turn on output compression
MAGIC_QUOTES_GPC//MAGIC_QUOTES_GPC
Think_version//thinkphp Version number
Lang_set//Browser language
Template_name//Current template name
Template_path//Current template path
__root__//Website root directory Address
__APP__//Current project (entry file) address
__URL__//Current module address
__ACTION__//Current operating address
__self__//Current URL address
Tmpl_file_name//Default template name for the current operation (with path)
Web_public_url//Website Public directory
App_public_url//Project Common template Catalog

system constants used in templates
__root__//Website root directory Address
__APP__//Current project (entry file) address
__URL__//Current module address
__ACTION__//Current operating address
__self__//Current URL address
__PUBLIC__//Website Public directory
.. /public (case-insensitive)//project Common template Catalog

thinkphp path (pure turn)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.