【问题标题】:Non-existent class: Template - Upgrade to Code Igniter 3.0.0不存在的类:模板 - 升级到 Code Igniter 3.0.0
【发布时间】:2015-04-01 03:26:35
【问题描述】:

我正在将 CodeIgniter2.2.0 升级到 3.0.0

它说

404 Page Not Found 糟糕,您要查找的页面未找到或 不可用。遇到错误

不存在的类:模板

ERROR - 2015-03-31 23:02:10 --> Non-existent class: Template
ERROR - 2015-03-31 23:02:31 --> Non-existent class: Template

我检查了 loader.php 没有 template.php



遇到错误

无法写入“标题”区域。区域未定义。

【问题讨论】:

    标签: php codeigniter logging error-handling upgrade


    【解决方案1】:

    尝试将类名更改为 Template 而不是 CI_Template。还要确保更改类的构造函数。

    【讨论】:

      【解决方案2】:

      我在库 system/libraries/className.php 上遇到了同样的问题,并通过将其更改为 application/libraries 来解决它。我想你也必须这样做。

      【讨论】:

      • 它并没有真正回答这个问题。但是,问题中的问题Non-existent class 通常在从system/libraries (CI3.x) 加载库时发生
      【解决方案3】:

      首先,您需要将类名从CI_Template 更改为Template,并将构造函数从CI_Template 更改为Template

      “模板”类的路径是

      root/application/libraries/Template.php

      其次,去

      root/application/config/template.php

      并添加您自己的区域。例如:

      $template['default']['template'] = 'template';
      $template['default']['regions'] = array(
         'header',
         'title',
         'content',
         'footer',
      );
      $template['default']['parser'] = 'parser';
      $template['default']['parser_method'] = 'parse';
      $template['default']['parse_template'] = FALSE;
      

      这对我有用。

      【讨论】:

        猜你喜欢
        • 2020-03-17
        • 1970-01-01
        • 1970-01-01
        • 2016-04-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-10-01
        • 2022-08-14
        相关资源
        最近更新 更多