Can't access fetch post data in controller: Codeigniter
问题 I'm making a post request using fetch in my codeigniter project. The request looks like this fetch('myurl/mycontroller', { method: 'POST', headers: { "Content-Type": "application/json" }, body: JSON.stringify({ testdata: 123, }) }).then((res) => { console.log(res); }).catch(console.log); My controller looks like below class MyController extends CI_Controller { public function mycontroller() { $data = $this->input->post('testdata'); return $data . " is the passed data."; } } But the data isn't