我是靠谱客的博主 爱笑口红,这篇文章主要介绍thinkphp3.2 获取__PUBLIC__绝对路径,现在分享给大家,希望可以做个参考。

thinkphp3.2 获取__PUBLIC__绝对路径

Home/Conf/config.php 修改成以下代码

<?php
// 项目路径 C:/www
$ROOT = $_SERVER['DOCUMENT_ROOT'];
// 返回服务器真实路径 C:/www/a/index.php
$Absolute_Path=$_SERVER['SCRIPT_FILENAME'];
// 截取index.php C:/www/a/
$Absolute_Path=str_replace("index.php","",$Absolute_Path);
// 获取绝对路径 /a/
$Absolute_Path= str_replace($ROOT,"",$Absolute_Path);

return array(
    //'配置项'=>'配置值'
    // 模板
    'TMPL_PARSE_STRING'    => array(
        '__PATH__'    =>  $Absolute_Path,              // /a/
        '__PUBLIC__'  =>  $Absolute_Path.'/Public',    // /a/Public/
    ),
);

最后

以上就是爱笑口红最近收集整理的关于thinkphp3.2 获取__PUBLIC__绝对路径的全部内容,更多相关thinkphp3.2内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(48)

评论列表共有 0 条评论

立即
投稿
返回
顶部