最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

thinkphp常見路徑用法分析

 更新時間:2014年12月02日 15:23:28   投稿:shichen2014  
這篇文章主要介紹了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(不區(qū)分大小寫):/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);   
//網(wǎng)站公共目錄   
$tmplContent = str_replace('__PUBLIC__',WEB_PUBLIC_URL,$tmplContent);   
//網(wǎng)站根目錄   
$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);

更多關(guān)于thinkPHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《ThinkPHP入門教程》、《thinkPHP模板操作技巧總結(jié)》、《ThinkPHP常用方法總結(jié)》、《smarty模板入門基礎教程》及《PHP模板技術(shù)總結(jié)》。

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

相關(guān)文章

最新評論

伊川县| 南平市| 岐山县| 基隆市| 保德县| 柘荣县| 满城县| 习水县| 福泉市| 武强县| 故城县| 兴城市| 通州区| 台南县| 揭西县| 咸丰县| 曲阜市| 汝阳县| 城固县| 浮梁县| 平南县| 福建省| 个旧市| 纳雍县| 昌乐县| 册亨县| 绥德县| 都兰县| 江安县| 府谷县| 湘潭县| 剑河县| 出国| 武城县| 沾益县| 阿拉善左旗| 扬中市| 秭归县| 常山县| 涞源县| 咸丰县|