这个php数组有什么问题

时间:2011-06-25 14:03:13

标签: php arrays

这是代码发出错误(codeigniter代码)

  

解析错误:语法错误,第25行意外的T_OBJECT_OPERATOR

更新

    <?php
class Main extends CI_Controller {



    public function index()
    {
        //$this->load->view('welcome_message');
        $this->load->helper('form');
        $this->load->helper('url');
        $this->load->view('feedback');
    }

    function submit()
    {
    $this->load->helper(array('form', 'url'));
    $this->load->library('form_validation');
    $this->load->helper('security');

    $data['course'] = $this->input->$this->input->post('course_attended');
    $data['trainer'] = $this->input->$this->input->post('trainer');
    $data['name'] = $this->input->$this->input->post('name');
    $data['company'] = $this->input->$this->input->post('company');
    $data['designation'] = $this->input->$this->input->post('designation');
    $data['phone'] = $this-input->$this->input->post('phone');
    $data['company_email'] = $this->input->$this->input->post('notes');
    $data['personal_email'] = $this->input->$this->input->post('personal_email');
    $data['address'] = $this-input->$this->input->post('address');
    $data['q0'] = $this->input->$this->input->post('q0');
    $data['q1'] = $this->input->$this->input->post('q1');
    $data['q2'] = $this->input->$this->input->post('q2');
    $data['q3'] = $this->input->$this->input->post('q3');
    $data['q4'] = $this->input->$this->input->post('q4');
    $data['q5'] = $this->input->$this->input->post('q5');
    $data['q6'] = $this->input->$this->input->post('q6');
    $data['q7'] = $this->input->$this->input->post('q7');
    $data['q8'] = $this->input->$this->input->post('q8');
    $data['q10'] = $this->input->$this->input->post('q10');
    $data['q11'] = $this->input->$this->input->post('q11');
    $data['aspects'] = $this->input->$this->input->post('aspects');
    $data['comments'] = $this->input->$this->input->post('comments');
    $data['ipaddress'] = $this->input->ip_address();
    $data['stamp'] = $now;


    //echo 'hi';
    print_r($data);

    }



}
?>

2 个答案:

答案 0 :(得分:6)

我猜你要改变

$this->input->$this->input->

$this->input->

答案 1 :(得分:4)

您在两次财产访问中缺少>个字符:

$data['phone'] = $this-input->$this->input->post('phone');
...
$data['address'] = $this-input->$this->input->post('address');

应该是

$data['phone'] = $this->input->$this->input->post('phone');
                       ^
...
$data['address'] = $this->input->$this->input->post('address');
                         ^