【问题标题】:codeigniter curl error代码点火器卷曲错误
【发布时间】:2012-07-02 19:34:54
【问题描述】:

我正在尝试这段代码并不断收到此错误 函数创建(){

    $post = array();

    //get all the data from the form into an array
    $post = array(
                'name' => $this->input->post('name'),
                'abbrev' => $this->input->post('abbrev'),           
                'long_name' => $this->input->post('long_name'),
                'long_abbrev' => $this->input->post('long_abbrev'),
                'url' => $this->input->post('url'),
                'description' => $this->input->post('description')
                );  


    //encode the data and set it as output to push to api
    $json_data=json_encode($post);
    $this->curl->post('http://localhost:8888/api/colleges', $json_data);

这是我得到的错误

严重性:通知

消息:未定义属性:Colleges::$curl

文件名:controllers/colleges.php

【问题讨论】:

    标签: php json codeigniter


    【解决方案1】:

    改变

     $this->curl->post('http://localhost:8888/api/colleges', $json_data);
    

     $this->load->library('curl');
     $this->curl->post('http://localhost:8888/api/colleges', $json_data);
    

    【讨论】:

      猜你喜欢
      • 2015-12-12
      • 2016-03-15
      • 2011-09-27
      • 2016-01-13
      • 1970-01-01
      • 2018-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多