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 展开
包含|-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 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询