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/
),
);