thường trong một hành động XHR tôi sử dụng mã nàyứng dụng đáp ứng 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));
Tôi tự hỏi nếu nó cần utf-8 mã hóa như thế này
$response->setHeader('Content-type', 'application/json;charset=UTF-8', true);
trong chế độ xem/trợ giúp Tôi chỉ thấy $ response = Zend_Controller_Front :: getInstance() -> getResponse(); $ response-> setHeader ('Content-Type', 'application/json', true); trả lại $ data; vì vậy ..... – Whisher
btw cảm ơn câu trả lời :) – Whisher
Có vẻ như 'sendJson' không được đặt cho phép bạn đặt một bộ ký tự cụ thể (ví dụ: utf-8). – Till