调用未定义的方法CI_Input :: load_query()

时间:2016-04-04 09:29:10

标签: php codeigniter

我正在使用codeigniter 3.0.4框架。我扩展了名为MY_input.php的输入类。我已将此文件放在application / core文件夹中。这在我的localhost xampp服务器上运行正常。但是当我在实时服务器上部署项目文件夹时,我收到此错误调用未定义的方法CI_Input :: load_query()。我已正确上传文件,我在实时服务器上的应用程序/核心文件夹中也有MY_input.php。

我仍然在我的localhost上成功运行它但不能在现场直播。我在这里粘贴相关代码。在Login_controller里面我有

 function displaySorted($query_id = 0,$sortBy = 'DeviceName',$sortOrder = 'asc',$offset=0)
    {

        $dataS = $this->session->userdata('logged_in');            
        if(isset($dataS))
        {
            $limit = 20;
            $data['offset'] = $this->uri->segment(6);
            $data['query_id']=$query_id;
            $data['fields'] = array(
                'ID' => 'ID',
                'DeviceType' => 'Device Type',
                'RegistrationDateTime' => 'RegistrationDateTime',
                'LastUpdateDateTime' => 'LastUpdateDateTime',
                'LastPushNotificationSent' => 'LastPushNotificationSent',
                'DeviceName' => 'Device Name',
                'Latitude' => 'Latitude',
                'Longitude' => 'Longitude',
                'CityName' => 'CityName',
                'StateName' => 'StateName',
                'CountryName' => 'CountryName',
                'AppVersion' => 'AppVersion',
                'iOSVersion' => 'iOSVersion',
                'IPAddress' => 'IPAddress',
                'TotalCities' => 'TotalCities',
                'DeviceDID' => 'DeviceDID',
                'DeviceToken'=> 'DeviceToken',
                'DeviceLanguageID'=> 'DeviceLanguageID',
                'LocationID' => 'LocationID',
                'TempScale' => 'TempScale',
                'IsFreezeAlertEnabled' => 'IsFreezeAlertEnabled',
                'ShouldShowTempOnBadge' => 'ShouldShowTempOnBadge',
                'ShowNegativeAsPositive' => 'ShowNegativeAsPositive',
                'LastTempC' => 'LastTempC',
                'LastTempF' => 'LastTempF',
                'IsDeviceUsingProdCert' => 'IsDeviceUsingProdCert'
            );              
            $this->input->load_query($query_id);
            $query_array = array(
                'DeviceName' => $this->input->get('DeviceName'),
                'RegistrationDateTime'  => $this->input->get('RegistrationDateTime'),
                'LastUpdateDateTime' => $this->input->get('LastUpdateDateTime'),
                'AppVersion' => $this->input->get('AppVersion'),
                'iOSVersion' => $this->input->get('iOSVersion'),
                'DeviceDID' => $this->input->get('DeviceDID'),
                'DeviceToken' => $this->input->get('DeviceToken')
            );

            $results = $this->user_model->searchSorted($query_array,$limit, $offset, $sortBy, $sortOrder);                
            $data['tableInfo'] = $results['rows'];
            $data['num_results'] = $results['num_rows'];
            $data['DeviceName'] =$query_array['DeviceName'];                $data['RegistrationDateTime']=$query_array['RegistrationDateTime'];
            $data['LastUpdateDateTime']=$query_array['LastUpdateDateTime'];
            $data['AppVersion']=$query_array['AppVersion'];
            $data['iOSVersion']=$query_array['iOSVersion'];
            $data['DeviceDID']=$query_array['DeviceDID'];
            $data['DeviceToken']=$query_array['DeviceToken'];
            //pagination functionality
            $config['base_url'] = site_url("login_controller/displaySorted/$query_id/$sortBy/$sortOrder");
            $config['per_page'] = $limit;
            $config['total_rows'] = $data['num_results'];
            $this->pagination->initialize($config);
            $data['pagination'] = $this->pagination->create_links();
            $data['sortBy'] = $sortBy;
            $data['sortOrder'] = $sortOrder;           
            $this->load->view('adminPanel_view', $data);
    }
    else
   {
       //echo $this->;exit;
       redirect('login_controller');
   }

}

现在MY_input.php包含以下代码:

class MY_input extends CI_Input
{
public function __construct()
{
    parent::__construct();

}
public function save_query($query_array)
{
    $CI =&get_instance();
    $CI->db->insert('ci_query',array('query_string'=> http_build_query($query_array)));
    return $CI->db->insert_id();
}

public function load_query($query_id)
{
    $CI =&get_instance();
    $rows = $CI->db->get_where('ci_query', array('id' => $query_id))->result();
    if (isset($rows[0]))
    {
        parse_str($rows[0]->query_string, $_GET);
    }
}
[![enter image description here][1]][1]}

现在错误不在代码中,但我放置了MY_input.php文件。但我不知道该怎么做以及如何解决这个问题,而且我不想改变codeigniter的核心框架文件。

1 个答案:

答案 0 :(得分:0)

我认为你应该使用正确的驼峰案例文件名:MY_Input.php
和班级名称:

class MY_Input extends CI_Input {

(请注意:我的字母是大写的)
见文件:
http://www.codeigniter.com/user_guide/general/core_classes.html