5
通常
在我使用此代碼的Zend響應應用程序/ JSON UTF-8
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$response = $this->getResponse();
$response->setHeader('Content-type', 'application/json', true);
return $response->setBody(Zend_Json::encode($data));
如果需要UTF-8編碼這樣
$response->setHeader('Content-type', 'application/json;charset=UTF-8', true);
in view/helper我只看到$ response = Zend_Controller_Front :: getInstance() - > getResponse(); $ response-> setHeader('Content-Type','application/json',true); 返回$ data;所以..... – Whisher
btw感謝回覆:) – Whisher
好像'sendJson'沒有設置允許你設置一個特定的字符集(例如utf-8)。 – Till