已经考到smarty下了,但是实例找不到
如图:
读者您好:
你是Linux系统,因此,config.php文件,您修改为这样,再试下。
<?php
function getpath(){
$mainpath=$_SERVER['DOCUMENT_ROOT'];
$filepath=$_SERVER['SCRIPT_FILENAME'];
$array=explode("/",$filepath);
$newarray=array();
for($i=0;$i<count($array)-1;$i++){
array_push($newarray,$array[$i]."/");
}
$abspath=implode("",$newarray);
$num=strlen($mainpath)-strlen($abspath);
$newpathtmp=substr($abspath,$num);
$newpath=$newpathtmp."Smarty/";
return($newpath);
}
$path=getpath();
define('BASE_PATH',$_SERVER['DOCUMENT_ROOT']);
define('SMARTY_PATH',$path);
require BASE_PATH.SMARTY_PATH.'libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->template_dir = BASE_PATH.SMARTY_PATH.'templates/';
$smarty->compile_dir = BASE_PATH.SMARTY_PATH.'templates_c/';
$smarty->config_dir = BASE_PATH.SMARTY_PATH.'configs/';
$smarty->cache_dir = BASE_PATH.SMARTY_PATH.'cache/';
?>