Json的使用较简单,以下是文档给出的用法:
Json 用来解码和发送 JSON 响应;
class FooController extends Zend_Controller_Action{ public function barAction() { // do some processing... // Send the JSON response: $this->_helper->json($data); // or... $this->_helper->json->sendJson($data); // or retrieve the json: $json = $this->_helper->json->encodeJson($data); }}
class FooController extends Zend_Controller_Action{ public function barAction() { // Retrieve the json, keeping layouts: $json = $this->_helper->json->encodeJson($data, true); }}