• <small id='XRpg6'></small><noframes id='XRpg6'>

        • <bdo id='XRpg6'></bdo><ul id='XRpg6'></ul>
        <legend id='XRpg6'><style id='XRpg6'><dir id='XRpg6'><q id='XRpg6'></q></dir></style></legend>
        <tfoot id='XRpg6'></tfoot>
        <i id='XRpg6'><tr id='XRpg6'><dt id='XRpg6'><q id='XRpg6'><span id='XRpg6'><b id='XRpg6'><form id='XRpg6'><ins id='XRpg6'></ins><ul id='XRpg6'></ul><sub id='XRpg6'></sub></form><legend id='XRpg6'></legend><bdo id='XRpg6'><pre id='XRpg6'><center id='XRpg6'></center></pre></bdo></b><th id='XRpg6'></th></span></q></dt></tr></i><div id='XRpg6'><tfoot id='XRpg6'></tfoot><dl id='XRpg6'><fieldset id='XRpg6'></fieldset></dl></div>
      1. 找不到代码点火器 MY_Controller

        codeigniter MY_Controller not found(找不到代码点火器 MY_Controller)

            <bdo id='k0fU8'></bdo><ul id='k0fU8'></ul>

            <i id='k0fU8'><tr id='k0fU8'><dt id='k0fU8'><q id='k0fU8'><span id='k0fU8'><b id='k0fU8'><form id='k0fU8'><ins id='k0fU8'></ins><ul id='k0fU8'></ul><sub id='k0fU8'></sub></form><legend id='k0fU8'></legend><bdo id='k0fU8'><pre id='k0fU8'><center id='k0fU8'></center></pre></bdo></b><th id='k0fU8'></th></span></q></dt></tr></i><div id='k0fU8'><tfoot id='k0fU8'></tfoot><dl id='k0fU8'><fieldset id='k0fU8'></fieldset></dl></div>
              <tfoot id='k0fU8'></tfoot>
            • <small id='k0fU8'></small><noframes id='k0fU8'>

                <tbody id='k0fU8'></tbody>
                <legend id='k0fU8'><style id='k0fU8'><dir id='k0fU8'><q id='k0fU8'></q></dir></style></legend>

                  本文介绍了找不到代码点火器 MY_Controller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在网站上使用 Codeigniter.2.1.3,所以我需要扩展 CI_Controller 以便我可以添加一个要与所有控制器一起执行的方法,所以我做了 user_guide 中的内容:

                  i’m using the Codeigniter.2.1.3 for a website, so i need to extend the CI_Controller so i can add a method to be executed with all controllers so i did what’s in the user_guide:

                  在 application/core 文件夹中创建一个名为 MY_Controller.php 的文件,在其中创建扩展 CI_Controller 的 MY_Controller 类,更改我的常规控制器以扩展 MY_controller,如下所示:MY_controller.php:

                  creating a file named MY_Controller.php in the application/core folder the creating in it MY_Controller Class that extends the CI_Controller, the changing my regular controller to extend the MY_controller like this: MY_controller.php:

                  class MY_Controller extends CI_Controller{
                      protected $page;
                      # Constructor
                      function __construct (){
                          parent::__construct();
                          #code shared with all controllers
                      }
                      public function get_page(){
                          #code to get_the right page here
                      }
                  }
                  

                  名为 Regular.php 的常规控制器:

                  regular controller named Regular.php:

                  class Regular extends MY_Controller{
                       public function __construct(){
                           parent::__construct();
                       }
                       public function index(){
                            $this->get_page();
                       }
                  }
                  

                  但不断出现以下错误:

                  致命错误:在第 2 行的/var/www/immo/CodeIgniter_2.1.3/application/controllers/regular.php 中找不到MY_Controller"类

                  Fatal error: Class ‘MY_Controller’ not found in /var/www/immo/CodeIgniter_2.1.3/application/controllers/regular.php on line 2

                  推荐答案

                  您需要包含您的 MY_Controller 类或自动加载它.我建议您通过将以下内容添加到您的 application/config/config.php 文件来自动加载它.

                  You would need to include your MY_Controller class or auto-load it. I suggest you auto-load it by adding the following to your application/config/config.php file.

                  function __autoload($class)
                  {
                      if (strpos($class, 'CI_') !== 0)
                      {
                          if (file_exists($file = APPPATH . 'core/' . $class . EXT))
                          {
                              include $file;
                          }
                      }
                  } 
                  

                  这篇关于找不到代码点火器 MY_Controller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Appending GET parameters to URL from lt;formgt; action(将 GET 参数附加到来自 lt;formgt; 的 URL行动)
                  Forcing quot;Save Asquot; dialog via jQuery GET(强制“另存为通过 jQuery GET 对话框)
                  PHP - get certain word from string(PHP - 从字符串中获取某个单词)
                  How to debug a get request in php using curl(如何使用 curl 在 php 中调试 get 请求)
                  get a # from a url in php(从 php 中的 url 获取 #)
                  PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)
                    <tbody id='CqGs0'></tbody>

                    <i id='CqGs0'><tr id='CqGs0'><dt id='CqGs0'><q id='CqGs0'><span id='CqGs0'><b id='CqGs0'><form id='CqGs0'><ins id='CqGs0'></ins><ul id='CqGs0'></ul><sub id='CqGs0'></sub></form><legend id='CqGs0'></legend><bdo id='CqGs0'><pre id='CqGs0'><center id='CqGs0'></center></pre></bdo></b><th id='CqGs0'></th></span></q></dt></tr></i><div id='CqGs0'><tfoot id='CqGs0'></tfoot><dl id='CqGs0'><fieldset id='CqGs0'></fieldset></dl></div>
                  • <small id='CqGs0'></small><noframes id='CqGs0'>

                      <bdo id='CqGs0'></bdo><ul id='CqGs0'></ul>

                            <tfoot id='CqGs0'></tfoot>

                            <legend id='CqGs0'><style id='CqGs0'><dir id='CqGs0'><q id='CqGs0'></q></dir></style></legend>