config.php文件如下:
<?php
$host="localhost";
$username="root";
$password="";
$dbname="test";
$charset="gb2312";
$smarty_template_dir ="../templates/";
$smarty_compile_dir ="../templates_c/";
$smarty_config_dir ="../configs/";
$smarty_cache_dir ="../cache/";
$smarty_delimiter =explode("|","{|}");
?>global.php代码如下:<?php
include_once('./configs/config.php');
include_once('./common/smarty/Smarty.class.php');
include_once('./common/mysql.class.php');
$db=new mysql($host,$username,$password,$dbname,$charset);$smarty=new Smarty();
$smarty->template_dir =$smarty_template_dir;
$smarty->compile_dir =$smarty_compile_dir;
$smarty->config_dir =$smarty_config_dir;
$smarty->cache_dir =$smarty_cache_dir;
$smarty->caching =false;
$smarty->left_delimiter =$smarty_delimiter[0];
$smarty->right_delimiter =$smarty_delimiter[1];
?>以下为文件目录截图:以下为浏览器错误提示:请各位看看,smarty新手
<?php
$host="localhost";
$username="root";
$password="";
$dbname="test";
$charset="gb2312";
$smarty_template_dir ="../templates/";
$smarty_compile_dir ="../templates_c/";
$smarty_config_dir ="../configs/";
$smarty_cache_dir ="../cache/";
$smarty_delimiter =explode("|","{|}");
?>global.php代码如下:<?php
include_once('./configs/config.php');
include_once('./common/smarty/Smarty.class.php');
include_once('./common/mysql.class.php');
$db=new mysql($host,$username,$password,$dbname,$charset);$smarty=new Smarty();
$smarty->template_dir =$smarty_template_dir;
$smarty->compile_dir =$smarty_compile_dir;
$smarty->config_dir =$smarty_config_dir;
$smarty->cache_dir =$smarty_cache_dir;
$smarty->caching =false;
$smarty->left_delimiter =$smarty_delimiter[0];
$smarty->right_delimiter =$smarty_delimiter[1];
?>以下为文件目录截图:以下为浏览器错误提示:请各位看看,smarty新手
$smarty_compile_dir ="./templates_c/";
$smarty_config_dir ="./configs/";
$smarty_cache_dir ="./cache/";相对路径是相对 global.php 的!
如果你 ../ 就跑到 php100new 上面去了,与 my 同级了
$smarty_template_dir ="./templates/";
$smarty_compile_dir ="./templates_c/";
$smarty_config_dir ="./configs/";
$smarty_cache_dir ="./cache/";
,结果还是一样;太头痛了
你前两个报错是出现在mysql.class.php中啊,你路径写错了吧,改smarty的路径有什么用
define('ROOT', dirname(__FILE__).'/..');include_once(ROOT.'/configs/config.php');
include_once(ROOT.'/common/smarty/Smarty.class.php');
include_once(ROOT.'/common/mysql.class.php');
$db=new mysql($host,$username,$password,$dbname,$charset);
$smarty=new Smarty();
$smarty->template_dir =$smarty_template_dir;
$smarty->compile_dir =$smarty_compile_dir;
$smarty->config_dir =$smarty_config_dir;
$smarty->cache_dir =$smarty_cache_dir;
$smarty->caching =false;
$smarty->left_delimiter =$smarty_delimiter[0];
$smarty->right_delimiter =$smarty_delimiter[1];$host="localhost";
$username="root";
$password="";
$dbname="test";
$charset="gb2312";
$smarty_template_dir =ROOT."/templates/";
$smarty_compile_dir =ROOT."/templates_c/";
$smarty_config_dir =ROOT."/configs/";
$smarty_cache_dir =ROOT."/cache/";
$smarty_delimiter =explode("|","{|}");
define('ROOT', dirname(__FILE__).'/..');
这句有问题 改成
define('ROOT', dirname(__FILE__));