0
我正在開發一個使用Zend Framework 2和Angular.js的應用程序。JsonModel返回兒童,選項和模板
我有一個Rest API模塊,並使用一個標準模塊返回JsonModel更具體的東西(問題居住在那裏)。
在我module.config.php,我配置了我view_manager這樣:
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => array(
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'portal/index/index' => __DIR__ . '/../view/portal/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
),
'template_path_stack' => array(
__DIR__ . '/../view',
),
'strategies' => array(
'ViewJsonStrategy'
)
),
之前,如果我這樣做:
...
return new JsonModel(array('teste'=>true));
...
回報率爲:
{"teste":true}
但我不知道是什麼原因,現在返回看起來像這樣:
{"children":[],"options":[],"template":"portal-admin\/transportadora\/verifica-cnpj-cadastrado","terminate":true,"variables":{"teste":true},"append":false}
我看過類參考中的任何答案,但什麼都沒發現。
有人可以幫我嗎?
謝謝。
編輯:我只想只返回「變量」。
您是否曾想過自從過去工作以來發生了哪些變化?你能提供一個返回響應的控制器片段嗎? – Ankh
@Svengali我現在解決了這個問題。問題出在我的控制器上。我沒有擴展AbstractActionController,而是擴展了AbstractRestfullController。很感謝! –