【发布时间】:2011-12-19 05:22:47
【问题描述】:
总是空白,我的控制器中有这样的操作
/**
* @Route("/check/{key}.json", defaults={"_format"="json"})
* @Template()
*/
public function processAction($upload_key)
{
/* make thing */
return array('data' => $process_data);
}
在我的 process.json.twig 文件中
{% set res = { 'data': data } %}
{{ res | json_enconde | raw }}
其他形式
{{ { 'data': data } | json_enconde | raw }}
我也试过这个:
{{ 'hello' | json_encode | raw }}
在 chrome 中我得到这个响应:
Connection:close
Content-Length:0
Content-Type:application/json
Date:Mon, 19 Dec 2011 05:13:17 GMT
Server:Apache/2.2.20 (Ubuntu)
X-Powered-By:PHP/5.3.6-13ubuntu3.3
从服务器上什么也得不到,我无法解决这个问题
【问题讨论】: