2,913   CodeIgniter HTTP PHP

CI有个CI_Output类,可以用来返回指定header的response,比如json数据
使用方法:


$this->output
        ->set_content_type('application/json')
        ->set_output(json_encode(array('foo' => 'bar')));

更多设置可以参考:http://www.codeigniter.com/user_guide/libraries/output.html




Leave a Reply

Your email address will not be published. Required fields are marked *