国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

thinkphp常見路徑用法分析

2024-05-04 23:28:30
字體:
來源:轉載
供稿:網友
這篇文章主要介紹了thinkphp常見路徑用法,實例分析了__PUBLIC__、__ROOT__、__APP__、__URL__、__ACTION__及__SELF__等標簽常量的用法,需要的朋友可以參考下
 
 

本文實例分析了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

模板中對路徑部分的操作是這樣子的:

復制代碼代碼如下:
//項目公共目錄    
 $tmplContent = str_ireplace('../public',APP_PUBLIC_URL,$tmplContent);    
//網站公共目錄    
$tmplContent = str_replace('__PUBLIC__',WEB_PUBLIC_URL,$tmplContent);    
//網站根目錄    
$tmplContent = str_replace('__ROOT__',__ROOT__,$tmplContent);    
//當前項目地址    
$tmplContent = str_replace('__APP__',__APP__,$tmplContent);    
 //當前模塊地址    
$tmplContent = str_replace('__URL__',__URL__,$tmplContent);    
 //當前項目操作地址    
$tmplContent = str_replace('__ACTION__',__ACTION__,$tmplContent);    
//當前頁面操作地址    
$tmplContent = str_replace('__SELF__',__SELF__,$tmplContent);

 

希望本文所述對大家基于ThinkPHP框架的PHP程序設計有所幫助。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 扎赉特旗| 新巴尔虎右旗| 乌苏市| 莒南县| 凤凰县| 上饶县| 股票| 金乡县| 荣成市| 纳雍县| 麻江县| 临城县| 汾阳市| 馆陶县| 磴口县| 肥乡县| 通城县| 龙岩市| 闻喜县| 武威市| 互助| 潮州市| 宁乡县| 大渡口区| 抚远县| 汉沽区| 沙河市| 河津市| 昔阳县| 临汾市| 磐安县| 南城县| 通城县| 固阳县| 祥云县| 无棣县| 禹城市| 余干县| 南昌县| 枞阳县| 余干县|