【问题标题】:PHP and Smarty: filemtime(): stat failedPHP 和 Smarty:filemtime(): stat failed
【发布时间】:2013-03-30 00:18:08
【问题描述】:

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

完整的错误是:

ERRNO: 2 TEXT: filemtime(): stat 失败 C:\hatshop/presentation//templates_c\74b952bedd7366ad261e8be04bc5be8ef15c2fc1.file.departments_list.tpl.php 位置: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("compiled") # 第 154 行,文件: C:\hatshop\libs\smarty\sysplugins\smarty_internal_templatebase.php Smarty_Internal_TemplateBase.fetch(空,空,空,空,假, false, true) # 第 286 行,文件: C:\hatshop\libs\smarty\sysplugins\smarty_internal_template.php Smarty_Internal_Template.getSubTemplate("departments_list.tpl", null, null, null, null, Array[0], "0") # 第 34 行,文件: C:\hatshop\presentation\templates_c\3522bf5c12e26ac546fbfc3693da6da22f71f1d6.file.index.tpl.php content_5155dc5df33599_26514511(对象:Smarty_Internal_Template)# 第 180 行,文件: C:\hatshop\libs\smarty\sysplugins\smarty_internal_templatebase.php Smarty_Internal_TemplateBase.fetch("index.tpl", null, null, null, true) # 第 374 行,文件: C:\hatshop\libs\smarty\sysplugins\smarty_internal_templatebase.php Smarty_Internal_TemplateBase.display("index.tpl") # 第 7 行,文件: C:\hatshop\index.php

我已经阅读了很多关于这个问题的帖子,但大部分都是 不清楚如何应用解决方案,他们只是提出建议 一种非常不清楚的方式。

【问题讨论】:

    标签: php smarty


    【解决方案1】:

    我有同样的错误通过添加解决它:

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

    请检查此链接:

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

    【讨论】:

      【解决方案2】:

      我也看到过这种错误,我认为它与在像 template_c 这样的 smarty 文件夹中设置的文件权限有关。因为 Smarty 会尝试判断我们是否可以使用缓存文件并尝试获取文件时间。请检查您的进程是否拥有正确的文件夹权限集

      【讨论】:

        【解决方案3】:

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

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-03-14
          • 2021-11-16
          • 1970-01-01
          • 2020-01-20
          相关资源
          最近更新 更多