我有这个数组
Zend_Db_Table_Row Object
(
[_data:protected] => Array
(
[impressions] => 748043
[clicks] => 20
[revenue] => 49.546194
[date] => 2014-04-30
)
[_cleanData:protected] => Array
(
[impressions] => 748043
[clicks] => 20
[revenue] => 49.546194
[date] => 2014-04-30
)
[_modifiedFields:protected] => Array
(
)
[_table:protected] => Application_Model_DbTable_Report Object
(
[_name:protected] => tbl_reporting
[_definition:protected] =>
[_definitionConfigName:protected] =>
[_db:protected] => Zend_Db_Adapter_Pdo_Mysql Object
(
[_pdoType:protected] => mysql
[_numericDataTypes:protected] => Array
(
为此,我尝试了echo Zend_Json::encode((array)$data_m6);
但是这给了我
{"\u0000*\u0000_data":{"impressions":"748043","clicks":"20","revenue":"49.546194","date":"2014-04-30"},"\u0000*\u0000_cleanData":{"impressions":"748043","clicks":"20","revenue":"49.546194","date":"2014-04-30"},"\u0000*\u0000_modifiedFields":[],"\u0000*\u0000_table":{},"\u0000*\u0000_connected":true,"\u0000*\u0000_readOnly":true,"\u0000*\u0000_tableClass":"Application_Model_DbTable_Report","\u0000*\u0000_primary":{"1":"entry_id"}}
我不需要\u0000*\u0000_...
这个所有字符
答案 0 :(得分:1)
假设您只需要存储在Zend_Db_Table_Row实例中的数据,您可以试试这个。
json_encode($object->toArray()); //Where object is your retrieved instance of Zend_Db_Table_Row.