日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

thinkphp当前php路径,分析thinkphp常见路径用法分析

發布時間:2024/9/19 php 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 thinkphp当前php路径,分析thinkphp常见路径用法分析 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

分析thinkphp常見路徑用法分析

文章主要介紹了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程序設計有所幫助。

【分析thinkphp常見路徑用法分析】相關文章:

總結

以上是生活随笔為你收集整理的thinkphp当前php路径,分析thinkphp常见路径用法分析的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。