请问一下为什么我不包含Smarty的时候能自动加载类!但是一但加载Smarty了就不让我自动加载类了!为什么?
以前没出现过这种情况这是第一次!/*系统设置类*/define(ROOT_PATH,substr(__FILE__,0,21));requireROOT_PATH."/l...
以前没出现过这种情况这是第一次!
/*系统设置类*/
define(ROOT_PATH,substr(__FILE__,0,21));
require ROOT_PATH."/libs/Smarty.class.php";
$smarty = new Smarty();
$smarty->template_dir = ROOT_PATH."/templates/";
$smarty->compile_dir = ROOT_PATH."/templates_c/";
$smarty->left_delimiter = "{=";
$smarty->right_delimiter = "=}";
$smarty->config_dir = ROOT_PATH."/configs/";
$smarty->cache=0;
$smarty->cache_lifetime = 60*60*24*7;
$smarty->cache_dir = ROOT_PATH."cache";
//设置时区
header("Content-type:text/html; charset=gb2312");
date_default_timezone_set("PRC");
function __autoload($class){
include "class/".$class."class.php";
} 展开
/*系统设置类*/
define(ROOT_PATH,substr(__FILE__,0,21));
require ROOT_PATH."/libs/Smarty.class.php";
$smarty = new Smarty();
$smarty->template_dir = ROOT_PATH."/templates/";
$smarty->compile_dir = ROOT_PATH."/templates_c/";
$smarty->left_delimiter = "{=";
$smarty->right_delimiter = "=}";
$smarty->config_dir = ROOT_PATH."/configs/";
$smarty->cache=0;
$smarty->cache_lifetime = 60*60*24*7;
$smarty->cache_dir = ROOT_PATH."cache";
//设置时区
header("Content-type:text/html; charset=gb2312");
date_default_timezone_set("PRC");
function __autoload($class){
include "class/".$class."class.php";
} 展开
1个回答
展开全部
我测试过了,问题可能是define(ROOT_PATH,substr(__FILE__,0,21));路径的长度可能刚好不是22个字符的长度,建议使用define("ROOT_PATH",dirname(__FILE__));;或者是include "class/".$class."class.php";这语句包含的路径不对。还有加载Smarty时在ROOT_PATH目录下一定要有templates、templates_c、configs和Cache(注意Cache第一个C是大写)这个文件夹
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询