0
這是用戶控制的我的索引行動:查詢Zend框架
$users = new Application_Model_DbTable_Users();
$this->view->users = $users->fetchAll(
$users->select('userid,username')
->order('userid ASC')
->limit(10, 0));
這是我的觀點:
<?php
echo "<pre>";
echo print_r($this->users);
?>
在輸出我想用戶表的結果的JSON,但數組在未來的觀點是 是
Zend_Db_Table_Rowset Object
(
[_data:protected] => Array
(
[0] => Array
(
[userid] => 1
[username] => rahul
[firstname] => rahul1
[lastname] => Khan2
[password] => ��2jr�``�(E]_�=^
[email] => [email protected]
[avatar] => 4cfe07efd2e1c.jpg
[updatedon] => 2011-01-23 18:45:49
[createdon] => 0000-00-00 00:00:00
[featuredgibs] =>
[defaultgib] =>
)
完全
但我想只有JSON:
{
"userid":"1",
"username": "rahul"
}
$用戶 - >使用fetchall($選擇)是返回一個Zend_Db_Table_Rowset對象,我將如何訪問數據,因爲它受保護? – XMen 2011-01-24 06:26:45