本文實例分析了thinkphp常見路徑用法。分享給大家供大家參考。具體如下:
這里介紹的標簽主要有: __root__ __self__ __action__ __url__ __app__ __public__
假如你項目首頁的URL是:www.test.com/other/Form
假如當前模塊是:Index
假如當前操作是:index
那么首頁完整的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(不區分大小寫):/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
模板中對路徑部分的操作是這樣子的:
希望本文所述對大家基于ThinkPHP框架的PHP程序設計有所幫助。
新聞熱點
疑難解答