Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP和Smarty:filemtime():stat失败_Php_Smarty - Fatal编程技术网

PHP和Smarty:filemtime():stat失败

PHP和Smarty:filemtime():stat失败,php,smarty,Php,Smarty,我收到以下错误filemtime():stat failed 完全错误是: 错误号:2 TEXT:filemtime():的stat失败 C:\hatshop/presentation//templates\u C\74B952BED7366AD261E8BE04BC5BE8EF15C2FC1.file.departments\u list.tpl.php 位置:C:\hatshop\libs\smarty\sysplugins\smarty\u resource.php,第行 720,2013

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

完全错误是:

错误号:2 TEXT:filemtime():的stat失败 C:\hatshop/presentation//templates\u C\74B952BED7366AD261E8BE04BC5BE8EF15C2FC1.file.departments\u list.tpl.php 位置:C:\hatshop\libs\smarty\sysplugins\smarty\u resource.php,第行 720,2013年3月30日上午12:14显示回溯: filemtime(“C:\hatshop/presentation//templates_C\74b952bedd7366ad261e8be04bc…”) #第720行,文件:C:\hatshop\libs\smarty\sysplugins\smarty\u resource.php Smarty_Template_Source.getCompiled(对象:Smarty_Internal_Template)# 第654行,文件: C:\hatshop\libs\smarty\sysplugins\smarty\u internal\u template.php Smarty_内部_模板。_获取(“编译”)#第154行,文件: C:\hatshop\libs\smarty\sysplugins\smarty\u internal\u templatebase.php Smarty_Internal_TemplateBase.fetch(null,null,null,null,false, 假,真)#第286行,文件: C:\hatshop\libs\smarty\sysplugins\smarty\u internal\u template.php Smarty_Internal_Template.getSubTemplate(“departments_list.tpl”),null, null,null,null,数组[0],“0”)#第34行,文件: C:\hatshop\presentation\templates\U C\3522bf5c12e26ac546fbfc3693da6da22f71f1d6.file.index.tpl.php 内容_5155dc5df33599_26514511(对象:Smarty_内部_模板)# 第180行,文件: C:\hatshop\libs\smarty\sysplugins\smarty\u internal\u templatebase.php Smarty_Internal_TemplateBase.fetch(“index.tpl”),null,null,null, 正确)#第374行,文件: C:\hatshop\libs\smarty\sysplugins\smarty\u internal\u templatebase.php Smarty_Internal_TemplateBase.display(“index.tpl”)#第7行,文件: C:\hatshop\index.php

我读过很多关于这个问题的帖子,但大多数都是这样 不清楚如何应用解决方案,他们只是在
一种非常不清楚的方法。

当注册的流包装器类没有定义的
url\u stat
方法时,就会发生这种情况。文档中不清楚,但PHP stat cache需要此方法。

我也看到过这种错误,我认为它与smarty文件夹(如template_c)中设置的文件权限有关。因为Smarty需要尝试确定是否可以使用缓存文件,并尝试获取文件时间。请检查您的进程是否对文件夹具有正确的权限集

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

$this->error_reporting = E_ALL & ~E_NOTICE;
$this->muteExpectedErrors();
到我的application.php

<?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');
    }

}

?>