我用 Codeigniter 創建了一個簡單的 Rest web 服務。當我從另一個應用程序使用 Curl 發送發布數據并顯示 $_POST 為空時。簡單的 PHP 客戶端:$url = 'http://localhost/ci-access/api_v1/register_events';$data = array( 'name' => 'tester');$ch = curl_init($url);curl_setopt($ch, CURLOPT_POSTFIELDS, $data);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_POST, true);$output = curl_exec($ch);curl_close($ch);Codeigniter 網絡服務:public function register_events() { die(var_dump($_POST));}在 Codeigniter 中是否有設置選項?如何讀取發布的數據?
- 1 回答
- 0 關注
- 221 瀏覽
添加回答
舉報
0/150
提交
取消