首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP和Smarty: filemtime():stat失败

PHP和Smarty: filemtime():stat失败
EN

Stack Overflow用户
提问于 2013-03-30 00:18:08
回答 3查看 4.6K关注 0票数 1

我得到以下错误filemtime(): stat failed

完全错误是:

ERRNO: 2文本: filemtime():stat failed for C:\hatshop/presentation//templates_c\74b952bedd7366ad261e8be04bc5be8ef15c2fc1.file.departments_list.tpl.php LOCATION: C:\hatshop\libs\smarty\sysplugins\smarty_resource.php,第720行,在2013年3月30日凌晨12:14显示回溯: filemtime("C:\hatshop/presentation//templates_c\74b952bedd7366ad261e8be04bc...") #第720行,文件: C:\hatshop\libs\smarty\sysplugins\smarty_resource.php Smarty_Template_Source.getCompiled(Object: Smarty_Internal_Template) #第654行,文件: C:\hatshop\libs\smarty\sysplugins\smarty_internal_template.php Smarty_Internal_Template.__get(“编译”)#第154行,文件: C:\hatshop\libs\smarty\sysplugins\smarty_internal_templatebase.php Smarty_Internal_TemplateBase.fetch(null,false,false,true) #第286行,文件: C:\hatshop\libs\smarty\sysplugins\smarty_internal_template.php Smarty_Internal_Template.getSubTemplate("departments_list.tpl",null,null,Array,"0") #第34行,文件: C:\hatshop\presentation\templates_c\3522bf5c12e26ac546fbfc3693da6da22f71f1d6.file.index.tpl.php content_5155dc5df33599_26514511(Object: Smarty_Internal_Template) #第180行文件: C:\hatshop\libs\smarty\sysplugins\smarty_internal_templatebase.php Smarty_Internal_TemplateBase.fetch("index.tpl",null,true) #第374行,文件: C:\hatshop\libs\smarty\sysplugins\smarty_internal_templatebase.php Smarty_Internal_TemplateBase.display("index.tpl") #第7行,文件: C:\hatshop\index.php

我读过很多关于这个问题的文章,但是他们中的大多数并不清楚如何应用这个解决方案,他们只是以一种非常不清楚的方式提出了一些建议。

EN

回答 3

Stack Overflow用户

发布于 2014-11-02 09:23:00

我通过添加以下内容解决了同样的错误:

代码语言:javascript
复制
$this->error_reporting = E_ALL & ~E_NOTICE;
$this->muteExpectedErrors();

给我的application.php

代码语言:javascript
复制
<?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();

       $this->error_reporting = E_ALL & ~E_NOTICE;
       $this->muteExpectedErrors();

        // Change the default template directories
        $this->template_dir = TEMPLATE_DIR;
        $this->compile_dir = COMPILE_DIR;
        $this->config_dir = CONFIG_DIR;
        $this->addPluginsDir(SMARTY_DIR . 'plugins');
        $this->addPluginsDir(PRESENTATION_DIR . 'smarty_plugins');
    }

}

?>

请检查此链接:

http://www.smarty.net/forums/viewtopic.php?t=21352&sid=88c6bbab5fb1fd84d3e4f18857d3d10e

票数 2
EN

Stack Overflow用户

发布于 2013-03-30 01:33:23

我也看到过这样的错误,我认为这与像template_c这样的智能文件夹中的文件权限设置有关。因为Smarty试图确定我们是否可以使用缓存的文件,并尝试获取文件时间。请检查您的进程是否对文件夹具有正确的权限集。

票数 1
EN

Stack Overflow用户

发布于 2013-03-30 00:35:12

当注册的流包装器类没有定义的url_stat方法时,就会发生这种情况。在文档中还不清楚,但是PHP stat缓存需要这种方法。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15713414

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档