magento拥有自己返回json数据的方法
$this->getResponse()->setHeader('Content-type', 'application/json');
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
本文介绍了一个在Magento中返回JSON数据的实用方法,通过设置响应头和使用核心助手类的jsonEncode函数来实现。
$this->getResponse()->setHeader('Content-type', 'application/json');
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
135

被折叠的 条评论
为什么被折叠?