gpt4 book ai didi

php - Zend 框架 JSON 输出

转载 作者:可可西里 更新时间:2023-11-01 13:03:39 25 4
gpt4 key购买 nike

在 Controller 中,我通过从 AJAX 传递的 ID 生成一个特殊表单。表单输出是 JSON。形式创造精细。但我的问题是在 View 中显示此 JSON。怎么办?

谢谢。

最佳答案

在 Controller 中(http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.json):

$this->getHelper('json')->sendJson(array(
'param1' => 'v1'
'param2' => 'v2'
));

在 View 中(http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.json):

<?php
echo $this->json(array(
'param1' => 'v1'
'param2' => 'v2'
));
?>

关于php - Zend 框架 JSON 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3715700/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com