5
我想爲我的解決方案安裝CodeIgniter RESTClient和RESTServer庫。 (philsturgeon-codeigniter-restclient和chriskacerguis-codeigniter-restserver)。Codeigniter restclient不工作
我設法讓其他服務器啓動並運行,但我遇到了其他客戶端的問題。
這些都是我做的步驟來我現在所在:
- 複製Rest.php文件(從GitHub下載),並把它的庫文件夾
- 下載Curl library,並把它在圖書館
- 修改在Rest.php代碼取消註釋
$this->_ci->load->library('curl');
(如果我將鼠標懸停在該文件中,我得到了以下信息捲曲庫的用途):
字段 '捲曲' 在是CI_Controller
沒有發現
我創建一個名爲 「RESTClient實現」 新控制器來測試我API。在這個控制器我創建了以下方法:
function rest_client_example($id) { $this->load->library('rest', array( 'server' => 'localhost/codeigniter/api/users/' )); $user = $this->rest->get('volunteer', array('id' => $id), 'json'); var_dump($user); }
瀏覽到http://localhost/codeigniter/api/restclient/rest_client_example/25然後給我
D:\wamp\www\codeigniter\application\controllers\api\Restclient.php:36:null
當執行下面的代碼,而不是上面的,我得到一個正確的結果:
$this->load->library('curl');
$t = $this->curl->simple_get('api/users/volunteer', array('id'=>$id));
var_dump($t);
所以我知道curl正在工作。
我的猜測是我在加載curl庫時出錯了嗎?
如果你什麼'$自動加載[ '圖書館'] =陣列( '捲曲', '休息');''在autoload.php' – jagad89