为什么CI加载表库返回错误500,目前无法处理此请求?

时间:2018-11-08 08:47:55

标签: codeigniter

所以我现在有一段时间这个问题了,我已经尝试解决了,但是我找不到问题所在。并且我已经尝试在google和论坛上找到解决方案,但找不到答案。

我有2个控制器,例如Controller AController B

控制器A可以毫无问题地调用函数export_table,但是控制器B不能调用相同的函数export_table。控制器B返回 HTTP ERROR 500错误,但是控制器A正常并且可以完美显示数据。

此函数仅包含

$this->ci->load->library('table');

仅用于故障排除。

但是为什么会这样?

我正在使用的CI版本是:3.0.0

已编辑:

哪怕只打电话

$this->load->library('table');
控制器B中的

将导致HTTP错误500

已编辑:

controller / Report.php

<?php if ( ! defined('BASEPATH') ) exit('No direct script access allowed');
    class Report extends CI_Controller{

        public function __construct(){
            parent::__construct();
        }

        public function index(){
            // Bunch of query and data that returns data into $data
            $this->myci->get_report_table($data);
        }
    }

controller / Inquiries.php

基本上,我只是复制粘贴所有内容,然后将类名从Report更改为Inquiries,并删除了一些不重要的部分

<?php if ( ! defined('BASEPATH') ) exit('No direct script access allowed');
    class Inquiries extends CI_Controller{

        public function __construct(){
            parent::__construct();
        }

        public function index(){
            // Bunch of query and data that returns data into $data
            $this->myci->get_report_table($data);
        }
    }

libraries / Myci.php

<?php if ( ! defined('BASEPATH') ) exit('No direct script access allowed');

class Myci {
    var $ci;
    private $session, $auth_page, $dashboard;
    public $user_role;

    function __construct() {
        $this->ci =& get_instance();
        $this->session = 'logged_in_user';
        $this->auth_page = 'auth';
        $this->dashboard = '/';
        $this->user_role = $this->get_user_role();
        $this->ci->load->model('deals');
    }

    function get_report_table($data){
        $this->ci->load->library('table');

        // Bunch of codes below
    }
}

问题是,当Report.php调用get_report_table()时,它工作正常,表显示并且数据正确,完全没有问题。

但是当查询调用get_report_table()时,HTTP错误500仅出现在查询中。只有加载库产生了错误,其他都没问题。所以我不知道出了什么问题,以前从未发生过

0 个答案:

没有答案
相关问题