我在寫一個使用CodeIgniter將服務器腳本存儲到數據庫中的腳本。我的客戶端發送一個JSON包包含HTML字符串:
<table style='width:50%'
但是從我的服務器端的我只能從$這個 - 獲取>後():
<table >
你知道自己做錯了什麼?
我完全錯誤日誌:
我從客戶端(編碼從AngularJS由$ .PARAM)JSON:
apikey=superrocket_51f0c7333392f&faqid=31&categoryid=44&question=How+to+format+the+answer+%3F&answer=%3Ctable+style%3D'width%3A50%25%3B'%3E&displayorder=0
我的PHP代碼來處理JSON:
function updateFAQs_post(){
$auth = $this->_auth();
if ($auth){
print_r($this->post('answer'));
$this->load->model('Admin_model');
$faqid = $this->Admin_model->updateFAQs($this->post('faqid'), $this->post('categoryid'), $this->post('question'), $this->post('answer'), $this->post('displayorder'));
$response = array('success' => 'update done', 'faqid' => $faqid, 'index' => $this->post('index'));
$this->response($response, 200);
}
}
我從服務器上得到的東西:
<table >{"success":"update done","faqid":null,"index":false}
預計faqid和index = null。它與錯誤無關。
我想這個錯誤是由於JavaScript編碼和PHP解碼JSON包的方式之間的區別?
我的回答對你有幫助嗎? –