PHP5和smarty配置问题
我刚开始读PHP和MySQL电子商务。作者要求下载smarty的最新版本。该书出版时是smarty 2.x,现在是smarty 3.x。 我将代码下载中的所有文件复制到我的文件夹中。我犯的错误是PHP5和smarty配置问题,php,smarty,smarty3,Php,Smarty,Smarty3,我刚开始读PHP和MySQL电子商务。作者要求下载smarty的最新版本。该书出版时是smarty 2.x,现在是smarty 3.x。 我将代码下载中的所有文件复制到我的文件夹中。我犯的错误是 Fatal error: Uncaught exception 'SmartyException' with message 'PHP5 requires you to call __construct() instead of Smarty()' 为了更正它,我将代码改为 <?php
Fatal error: Uncaught exception 'SmartyException' with message 'PHP5 requires you to call __construct() instead of Smarty()'
为了更正它,我将代码改为
<?php
// Reference Smarty library
require_once SMARTY_DIR . 'Smarty.class.php';
/* Class that extends Smarty, used to process and display Smarty files */
class Application extends Smarty
{
// Class constructor
public function __construct()
{
// Call Smarty's constructor
parent::__construct();
// Change the default template directories
$this->template_dir = TEMPLATE_DIR;
$this->compile_dir = COMPILE_DIR;
$this->config_dir = CONFIG_DIR;
}
}
?>
我已经关注了以下链接
然后我得到了这个错误:
错误号:2 TEXT:filemtime:stat失败
C:\xampp\htdocs\tshirtshop/presentation/templates\u C\b34e4db7de306d57170626b504196f0c5fe34fa4.file.store_front.tpl.php
地点:
C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty_resource.php,
第772行,2014年8月22日上午9:59显示回溯:
filemtimeC:\xampp\htdocs\tshirtshop/presentation/templates\u c\b34e4db7de30。。。
第772行,文件:C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty\u resource.php
Smarty_Template_Source.getCompiledObject:Smarty_Internal_Template
第699行,文件:
C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty\u internal\u template.php
Smarty_内部_模板。_已编译第154行,文件:
C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty\u internal\u templatebase.php
Smarty_Internal_TemplateBase.fetchstore_front.tpl,null,null,
null,真,第394行,文件:
C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty\u internal\u templatebase.php
Smarty_Internal_TemplateBase.displaystore_front.tpl第16行,
文件:C:\xampp\htdocs\tshirtshop\index.php
您的PHP代码看起来不错 您应该清除编译的模板目录,检查目录/文件权限,如果没有帮助,实际上您不应该在意。这些警告是由于某些文件系统操作优化引起的 如果要关闭它们,可以使用:
$this->muteExpectedErrors();
在构造函数中,可能是在调用父构造函数之后 您在smarty模板中做了什么?我认为这段代码没有任何问题,只是您应该使用setter。