求助~~!smarty3.0 网站不能使用 500错误

无以伦比的时间 2010-09-25 01:04:21
存放目录是smarty 网站根目录下web/smarty,设置的config.inc.php配置文件
<?php

/*
* 只要把此文件放在和templates,templates_c,cache,configs同一个目录下,
* 在其它地方只要调用这个文件,就可以显示出来了。
*
*/

$PathArray = explode('smarty',str_replace('\\','/',dirname(__FILE__)));

define('ROOT',$PathArray[0] ); //设置网站文件的绝对路径
define('SMARTY_ROOT',ROOT.'smarty/'); //设置Smarty类库路径

require_once 'Smarty.class.php';
$Smarty = new Smarty(); //建立新的Smarty对象
$Smarty -> compile_check = TRUE; //每次PHP执行时查看模板文件的内容是否改变。
//debugging控制台,这是一个开关参数,如果打开它将显示Smarty变量和运行状态的调试窗口。
$Smarty -> debugging = FALSE;

//设置模板目录
$Smarty -> template_dir = SMARTY_ROOT.'temp/';

//Smarty默认的模板目录名:templates_c
$Smarty -> compile_dir = SMARTY_ROOT.'temp_c/';

//默认模板缓存的目录名
$Smarty -> cache_dir = SMARTY_ROOT.'cache/';

//默认的config文件目录名:configs
$Smarty -> config_dir = SMARTY_ROOT.'configs/';

//左右边界符,默认为{},但实际应用当中容易与JavaScript相冲突,所以建议设成<{}>或其它。
$Smarty -> left_delimiter = '<{';
$Smarty -> right_delimiter = '}>';

?>

测试文件 php文件
<?php
require_once 'config.inc.php';//只要能把这个文件包含进来,test.php文件放在哪都可以。

$Smarty->assign("title", "测试成功了,这是标题"); //进行模板变量替换
$Smarty->assign("content", "测试结果成功"); //进行模板变量替换
$Smarty->display('test.html');//编译并显示位于./templates下的index.tpl模板
?>

测试 模板文件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><{$title}></title>
</head>
<body>
<{$content}>
</body>
</html>


现在是完全搞不懂··哪里出错了 运行php文件就是出现500错误
...全文
164 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
bailixia520 2010-10-01
  • 打赏
  • 举报
回复
关注。。。
kaifadi 2010-10-01
  • 打赏
  • 举报
回复
关注:::!
  • 打赏
  • 举报
回复
我本地存放网站的更目录的地址显示出来了啊·
array(2) { [0]=> string(26) "D:/wwwroot/lk19851010/Web/" [1]=> string(0) "" }
ihefe 2010-09-25
  • 打赏
  • 举报
回复



$PathArray = explode('smarty',str_replace('\\','/',dirname(__FILE__)));

var_dump($PathArray);

//看看输出什么

4,251

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧