0
我在我的視圖中定義了一個名爲Student的變量。在我看來,如何將Student對象顯示爲JSON?如何在Zend Framework中以JSON格式返回Application_Model 1.11
public function previewAction()
{
// ...
$this->view->student = $student;
}
在我preview.phtml觀,我有以下幾點:
<script>
// this doesn't return the Application_Model as a JSON object in the html
var studentData = <?php echo Zend_Json::encode($this->student); ?>;
</script>
請問這個回報把雙引號? – skafandri