我的问题是我使用 php 版本 5.4 会在 MY_Controllar 中出现这个错误,请看下面的截图
但是php版本5.3以下没有问题
这是我的代码
<?php
class MY_Controller extends CI_Controller {
function __construct()
{
parent::__construct();
$data->the_leave_data = $this->leave_data(); <--- line 8 is here
$this->the_leave_data = $data->the_leave_data;
$this->load->vars($data);
}
function leave_data()
{
$data = array();
$this->load->model('leave_data_model');
$staff_id = $this->session->userdata('staff_id');
if($query = $this->leave_data_model->get_by('staff_id',$staff_id))
{
$data['leave_data_records'] = $query;
}
var_dump($data);
return $data;
}
}
?>
这是 $data 的 var_dump 返回值
leave_data_records' =>
object(stdClass)[21]
public 'leave_data_id' => string '1' (length=1)
public 'staff_id' => string '1' (length=1)
public 'annual_leave' => string '1.0' (length=3)
public 'sick_leave' => string '0.0' (length=3)
public 'annual_leave_balance' => string '0.0' (length=3)
public 'sick_leave_balance' => string '0.0' (length=3)
public 'year' => string '2012' (length=4)
任何想法如何解决它?谢谢