Php codeigniter中的非法字符串偏移

Php codeigniter中的非法字符串偏移,php,codeigniter,codeigniter-2,Php,Codeigniter,Codeigniter 2,我正在使用codeigniter开发一个物业管理系统。我在控制器中的函数中定义的每个$data[''都会得到illegel偏移错误。同一控制器中的其他功能工作正常,没有任何问题。我试着用现有的答案来回答“illegel offest”错误,但这些答案都没有回答我的问题。这是我的密码:- 模型(Model_seasure.php):- 以下是控制器(seasure.php):- 问题解决了。问题是控制器中函数navigateToSeason($data)中的参数。我将perameter$data重

我正在使用codeigniter开发一个物业管理系统。我在控制器中的函数中定义的每个$data[''都会得到illegel偏移错误。同一控制器中的其他功能工作正常,没有任何问题。我试着用现有的答案来回答“illegel offest”错误,但这些答案都没有回答我的问题。这是我的密码:-

模型(Model_seasure.php):-

以下是控制器(seasure.php):-


问题解决了。问题是控制器中函数navigateToSeason($data)中的参数。我将perameter$data重命名为$data_u,它现在工作正常。请确保为每个函数选择不同的参数名称

            function insertSeason($data){

            $season_flag = '';

            $this->db->insert("season",$data);


            if ($this->db->affected_rows()>0){

                    $season_flag = true;
           } else {

                    $season_flag = false;
           }

               return $season_flag;

         }




       function getAllSeason(){


        $this->db->select('*');
        $this->db->from('season');
        $this->db->join('property', 'property.PropertyID = season.SeasonID', 'inner');
        $this->db->order_by('season.SeasonID', 'DESC');

        //$this->db->from('season');
        //$this->db->order_by("SeasonID", "DESC");
        $query = $this->db->get();
        return $query->result();

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

class Season extends CI_Controller{



    function __construct(){

        parent::__construct();
        $this->load->model('model_season');
        $this->load->model('model_property');
        $this->load->model('user');

        
     }


     function index(){

            if ($this->session->userdata('logged_in'))
            {
                $this->load->helper(array('form'));
        
                $this->lang->load('common');
                $this->lang->load('season');

                $session_data = $this->session->userdata('logged_in');
                $data['user_name']          = $session_data['user_name'];
                $data['property_list']      = $this->model_property->GetAllProperty();
                $data['season_list']        = $this->model_season->getAllSeason();


                $this->load->view('backend/header');
                $this->load->view('backend/add_season_view',$data);
                $this->load->view('backend/footer');


            } else {

                redirect('login', 'refresh');
            }
     }





      function navigateToSeason($data_){



            if ($this->session->userdata('logged_in'))
            {


                


                $this->load->helper(array('form'));
        
                $this->lang->load('common');
                $this->lang->load('season');

                $session_data = $this->session->userdata('logged_in');
                $data['user_name']          = $session_data['user_name'];
                $data['property_list']      = $this->model_property->GetAllProperty();
                //var_dump($this->model_season->getAllSeason());
                $data['season_list']        = $this->model_season->getAllSeason();

                if ($data_ == 1){
                $data['message'] = "success";
                }
                if ($data_ == 0){
                        $data['message'] = "error..";
                }

                
                $this->load->view('backend/header');
                $this->load->view('backend/add_season_view',$data);
                $this->load->view('backend/footer');


            } else {

                redirect('login', 'refresh');
            }
     }

     function addSeason(){

                echo 'function test pass..';


                $username = $this->input->post('username');

                $this->load->library('form_validation');

                $validaton_options = array (

                            array(

                                        'field' => 'season_selected_property',
                                        'label' => 'Property',
                                        'rules' => 'trim|numeric|required|xss_clean'
                                ),



                            array(

                                        'field' => 'season_title',
                                        'label' => 'Season Title',
                                        'rules' => 'trim|required|xss_clean'
                                ),



                            array(

                                        'field' => 'season_start_date',
                                        'label' => 'Season start date',
                                        'rules' => 'trim|required|callback_date_valid'
                                ),



                            array(

                                        'field' => 'season_end_date',
                                        'label' => 'Season end date',
                                        'rules' => 'trim|required|callback_date_valid'
                                )
                    );


                    $this->form_validation->set_rules($validaton_options);


                    //start form validation
                    if ($this->form_validation->run() == true){

                                
                                $NewSeason = array(

                                        "SeasonPropertyID"=> $this->input->post('season_selected_property'),
                                        "SeasonTitle"=>$this->input->post('season_title'),
                                        "StartDate"=>$this->input->post('season_start_date'),
                                        "EndDate"=>$this->input->post('season_end_date')


                                );


                                //check - add to database
                                if ($this->model_season->insertSeason($NewSeason)){     

                                        redirect('season/navigateToSeason/1','refresh');


                                } else {

                                        redirect('season/navigateToSeason/0','refresh');

                                }
                                // end database add






                    } else {

                        
                                            if ($this->session->userdata('logged_in'))
                                            {
                                                $this->load->helper(array('form'));
                                        
                                                $this->lang->load('common');
                                                $this->lang->load('season');

                                                $session_data = $this->session->userdata('logged_in');
                                                $data['user_name'] = $session_data['user_name'];
                                                $data['property_list']      = $this->model_property->GetAllProperty();
                                                $data['season_list']        = $this->model_season->getAllSeason();
                                                

                                                $this->load->view('backend/header');
                                                $this->load->view('backend/add_season_view',$data);
                                                $this->load->view('backend/footer');


                                            } else {

                                                redirect('login', 'refresh');
                                            }

                    }
                    //end form validation


     }//end function



     public function date_valid($date)
    {
            $parts = explode("-", $date);
            if (count($parts) == 3) {      
                    if (checkdate($parts[1], $parts[2], $parts[0]))
                    {
                        return TRUE;
                    }
            }
            
            $this->form_validation->set_message('date_valid', 'The Date field must be yyyy-mm-dd');

            return false;
    }









}


?>
  <?php if (isset($message)  && $message != ''){

                echo  $message;
            }


       if (isset($user_name) && $user_name != ''){
                  echo $user_name;
       }




         if (isset($season_list))
         {  


                       foreach ($season_list as $season){


                                        echo $season->SeasonTitle; 
                                        echo $season->StartDate; 
                                        echo $season->EndDate; 
                       }


          }

 ?>
 array(2) { [0]=> object(stdClass)#42 (29) { ["SeasonID"]=> string(1) "2" ["SeasonPropertyID"]=> string(2) "14" ["SeasonTitle"]=> string(6) "ghfghf" ["StartDate"]=> string(10) "2014-11-24" ["EndDate"]=> string(10) "2014-11-30" ["PropertyID"]=> string(1) "2" ["Title"]=> string(16) "Hill Apartment" ["Description"]=> string(562) "In March 2014, Nayon “ †Fonseka, re-established Lake House, a 13-room Bed & Breakfast / Budget Hotel, that has been owned by her family for 40 years. Down a quiet residential lane in the heart of commercial city, Lake House was one of the first accredited tourist accommodations in the Island, which   refurbished with her usual creative flair. Conceived as a ‘home away from home’ while in the Island, whether for a few days of holiday or a month on business, Lake House is ideally located and run in an unobtrusive, yet professional manner." ["StarRating"]=> string(1) "4" ["GoogleMapURL"]=> string(25) "https://goo.gl/maps/xKwPQ" ["Address"]=> string(20) "alvo Terrace, Kandy" ["Telephone"]=> string(11) "94112326443" ["Fax"]=> string(11) "94112326443" ["TripAdvisorURL"]=> string(116) "http://www.tripadvisor.com/Hotel_Review-g293962-d586475-Reviews- _Villas_Lake_Lodge-city_Western_Province.html" ["ThumbNail1"]=> string(6) "DD.jpg" ["ThumbNail2"]=> string(0) "" ["ThumbNail3"]=> string(0) "" ["WebSiteURL"]=> string(18) "www. villas.com" ["Email"]=> string(24) "lakelodge@ villas.com" ["TaxChargesPercentage"]=> string(1) "2" ["TaxDescription"]=> string(60) "This includes service charges and the Island Government taxes" ["Enabled"]=> string(1) "1" ["DateCreated"]=> string(10) "2014-10-31" ["CreatedBy"]=> string(8) " vila" ["LastModified"]=> string(10) "2014-11-05" ["ModifiedBy"]=> string(8) " vila" ["ExtraBedPrice"]=> string(3) "120" ["Direction"]=> string(477) "Lake House is situated down alvo terrace off alvo place. You have to access it through Perehera Mawatha, which is off Sir James Pieris Mawatha (this is the road going towards the Nawaloka hospital). On Perahera Mawatha, passing Bishop’s College auditorium is a playground, you take the first turn on to your left after you pass the playground, which is alvo Place. Down alvo Place the first turn to your left is alvo terrace, the hotel is right at the bottom of the lane" ["ExtraBed"]=> string(1) "0" } [1]=> object(stdClass)#41 (29) { ["SeasonID"]=> string(1) "1" ["SeasonPropertyID"]=> string(2) "25" ["SeasonTitle"]=> string(10) "Off Season" ["StartDate"]=> string(10) "2014-11-10" ["EndDate"]=> string(10) "2014-11-24" ["PropertyID"]=> string(1) "1" ["Title"]=> string(8) "DD Lodge" ["Description"]=> string(562) "In March 2014, Nayon “ †Fonseka, re-established Lake House, a 13-room Bed & Breakfast / Budget Hotel, that has been owned by her family for 40 years. Down a quiet residential lane in the heart of commercial city, Lake House was one of the first accredited tourist accommodations in the Island, which   refurbished with her usual creative flair. Conceived as a ‘home away from home’ while in the Island, whether for a few days of holiday or a month on business, Lake House is ideally located and run in an unobtrusive, yet professional manner." ["StarRating"]=> string(1) "3" ["GoogleMapURL"]=> string(25) "https://goo.gl/maps/xKwPQ" ["Address"]=> string(30) "alvo Terrace, city 3 00300" ["Telephone"]=> string(11) "94112326443" ["Fax"]=> string(11) "94112326443" ["TripAdvisorURL"]=> string(116) "http://www.tripadvisor.com/Hotel_Review-g293962-d586475-Reviews- _Villas_Lake_Lodge-city_Western_Province.html" ["ThumbNail1"]=> string(7) "LL1.jpg" ["ThumbNail2"]=> string(1) "0" ["ThumbNail3"]=> string(1) "0" ["WebSiteURL"]=> string(18) "www. villas.com" ["Email"]=> string(24) "lakelodge@ villas.com" ["TaxChargesPercentage"]=> string(1) "2" ["TaxDescription"]=> string(60) "This includes service charges and the Island Government taxes" ["Enabled"]=> string(1) "1" ["DateCreated"]=> string(10) "0000-00-00" ["CreatedBy"]=> string(0) "" ["LastModified"]=> string(10) "0000-00-00" ["ModifiedBy"]=> string(0) "" ["ExtraBedPrice"]=> string(1) "0" ["Direction"]=> string(477) "Lake House is situated down alvo terrace off alvo place. You have to access it through Perehera Mawatha, which is off Sir James Pieris Mawatha (this is the road going towards the Nawaloka hospital). On Perahera Mawatha, passing Bishop’s College auditorium is a playground, you take the first turn on to your left after you pass the playground, which is alvo Place. Down alvo Place the first turn to your left is alvo terrace, the hotel is right at the bottom of the lane" ["ExtraBed"]=> string(1) "0" } }