سؤال

I have this array

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
                        (

For this I tried echo Zend_Json::encode((array)$data_m6);

but this gives me

{"\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"}}

I don't need \u0000*\u0000_... this all characters

هل كانت مفيدة؟

المحلول

Assuming that you only need the data stored in your instance of Zend_Db_Table_Row you can try this.

json_encode($object->toArray()); //Where object is your retrieved instance of Zend_Db_Table_Row.
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top