您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

thinkphp常见路径用法分析_PHP

2024/4/9 4:18:28发布9次查看
本文实例分析了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程序设计有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product