smarty路径配置问题 问题很细,期待高手。

C:\AppServ\www\dlpx\包含|-smarty|+templates|+templates_c|+cache|-configs|-config|-Smart... C:\AppServ\www\dlpx\
包含|-smarty
|+templates
|+templates_c
|+cache
|-configs
|-config
|-Smarty.class
|-index.php
|-index.html

index.php
<?php
include_once("smarty/configs/config.php");
$arr = array('computerbook','name' => 'PHP从入门道具精通','unit_price' => array('price' => '¥65.00','unit' => '本'));
$smarty->assign('title','使用Smarty读取数组');
$smarty->assign('arr',$arr);
$smarty->display('index.html');
?>

config.php
<?php
/* 定义服务器的绝对路径 */
//define('BASE_PATH',$_SERVER['DOCUMENT_ROOT']);
/* 定义Smarty目录的绝对路径 */
//define('SMARTY_PATH','\dlpx\samrty\Smarty\\');
/* 加载Smarty类库文件 */
//require BASE_PATH.SMARTY_PATH.'Smarty.class.php';
/* 实例化一个Smarty对象 */
//require "smarty/Smarty.class.php";
//这个是之前用的一出现类似错误。留下来请大家也看看

define('base_path','C:/AppServer/www/');
define('smarty_path',base_path.'dlpx/smarty/');
require_once(smarty_path.'Smarty.cl0ass.php');
$smarty = new Smarty();
//$dir = "C:/AppServer/www/dlpx/";
$smarty->template_dir = smarty_path.'templates/';
$smarty->compile_dir = smarty_path.'templates_c/';
$smarty->config_dir = smarty_path.'configs/';
$smarty->cache_dir = smarty_path.'cache/';
?>

config.php里的smarty.class.php在DW中显示为找不到该文件。

错误是:
Warning: main(../config.php): failed to open stream: No such file or directory in c:\appserv\www\dlpx\index.php on line 2

Warning: main(): Failed opening '../config.php' for inclusion (include_path='.;c:\php4\pear') in c:\appserv\www\dlpx\index.php on line 2

Warning: main(c:/appserv/www\dlpx\samrty\Smarty\Smarty.class.php): failed to open stream: No such file or directory in c:\appserv\www\dlpx\smarty\configs\config.php on line 7

Warning: main(c:/appserv/www\dlpx\samrty\Smarty\Smarty.class.php): failed to open stream: No such file or directory in c:\appserv\www\dlpx\smarty\configs\config.php on line 7

Fatal error: main(): Failed opening required 'c:/appserv/www\dlpx\samrty\Smarty\Smarty.class.php' (include_path='.;c:\php4\pear') in c:\appserv\www\dlpx\smarty\configs\config.php on line 7
展开
 我来答
百度网友3e2e435
2011-01-12
知道答主
回答量:21
采纳率:0%
帮助的人:16.6万
展开全部
config.php
define('base_path','C:/AppServer/www/');
改成
define('base_path','C:/AppServ/www/');

require_once(smarty_path.'Smarty.cl0ass.php');
改成
require_once(smarty_path.'Smarty.class.php');
以后注意认真些,我也经常犯这种错误:)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式