ThinkPhP 路徑定義

ZY_FlyWay發表於2017-11-28

1. '__TMPL__'      =>  APP_TMPL_PATH,  // 專案模板目錄
2. '__ROOT__'      =>  __ROOT__,       // 當前網站地址
3. '__APP__'       =>  __APP__,        // 當前專案地址
4. '__GROUP__'     =>  defined('GROUP_NAME')?__GROUP__:__APP__,
5. '__ACTION__'    =>  __ACTION__,     // 當前操作地址
6. '__SELF__'      =>  __SELF__,       // 當前頁面地址
7. '__URL__'       =>  __URL__,
8. '../Public'     =>  APP_TMPL_PATH.'Public',// 專案公共模板目錄
9. '__PUBLIC__'    =>  __ROOT__.'/Public',// 站點公共目錄

例如:

這裡介紹的標籤主要有: __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


相關文章