PHP文件:<?php
ob_start('ob_gzhandler');
require('Smarty/libs/Smarty.class.php');
$smarty = new Smarty();
$smarty->assign("title", 'Smarty Rocks!');
$smarty->assign("name", 'Jason Gilmore');
$smarty->display('Smarty/demo/templates/welcome.tpl');
?>
welcome.tpl:<html>
<head>
<title>{$title}</title>
</head>
<body>
<p>Hi, {$name}. Welcome to the wonderful world of Smarty.</p>
</body>
</html>
运行PHP文件时却显示:Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'Smarty/demo/templates/welcome.tpl'' in D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatebase.php:127 Stack trace: #0 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatebase.php(374): Smarty_Internal_TemplateBase->fetch('Smarty/demo/tem...', NULL, NULL, NULL, true) #1 D:\Apache Group\Apache2\htdocs\PHPProject\index3.php(15): Smarty_Internal_TemplateBase->display('Smarty/demo/tem...') #2 {main} thrown in D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatebase.php on line 127
我用的是zend studio 9,在网站文件夹中的“PHP Include Path”中也导入了Smart\demo\templates(这是welcome.tpl放置的位置,这个Smart在我的D:\php5\includes中)中了,为什么还显示错误?
ob_start('ob_gzhandler');
require('Smarty/libs/Smarty.class.php');
$smarty = new Smarty();
$smarty->assign("title", 'Smarty Rocks!');
$smarty->assign("name", 'Jason Gilmore');
$smarty->display('Smarty/demo/templates/welcome.tpl');
?>
welcome.tpl:<html>
<head>
<title>{$title}</title>
</head>
<body>
<p>Hi, {$name}. Welcome to the wonderful world of Smarty.</p>
</body>
</html>
运行PHP文件时却显示:Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'Smarty/demo/templates/welcome.tpl'' in D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatebase.php:127 Stack trace: #0 D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatebase.php(374): Smarty_Internal_TemplateBase->fetch('Smarty/demo/tem...', NULL, NULL, NULL, true) #1 D:\Apache Group\Apache2\htdocs\PHPProject\index3.php(15): Smarty_Internal_TemplateBase->display('Smarty/demo/tem...') #2 {main} thrown in D:\php5\includes\Smarty\libs\sysplugins\smarty_internal_templatebase.php on line 127
我用的是zend studio 9,在网站文件夹中的“PHP Include Path”中也导入了Smart\demo\templates(这是welcome.tpl放置的位置,这个Smart在我的D:\php5\includes中)中了,为什么还显示错误?
解决方案 »
- win2008 r2下php程序运行500错误请教!
- php 条件语句中的执行体{}可以被:代替??
- phpStudy 1.7.0 基础问题 我是菜鸟
- 帮我解释一下这个正则好么?
- 定义鼠标的、滚动条的css有哪几个?
- 之前问过,没得到答案,请大家再帮帮忙!
- 问一个简单的问题
- 为什么PHP生成的图片不能正常显示
- php 绘图函数可否绘制出这样的文字效果?
- 請大家幫忙看看!!!能用 <select> 做出分層的下拉菜單不,如果不行有什麼辦法來代替呢???
- 能不能用textarea标签手动给数组里加内容!!!!
- 利用stream_socket_client实现多线程遇到问题,stream_socket_client没有调用给定的url,是不是方法不对?
参数相对而言的你检测下 Smarty 文件夹下有没 demo 文件夹下有没 templates 文件夹下有没 welcome.tpl 文件
$smarty->addTemplateDir("./Smarty/demo/templates/");
这个是3.1.10版本的