从对象zend

时间:2016-06-03 09:20:54

标签: zend-framework

我有回复,我想从中获取referenceId,响应是

Application_Model_User Object
(
[_data:protected] => Array
    (
        [id] => 2
        [email] => test@gmail.com
        [password] => ef1dca60798e10a51e3b6201ae7c40fbe2a10887
        [salt] => 87fc83906190d1e29b60c5813065af068e16459d
        [name] => test
        [creationDate] => 2011-07-05
        [lastTimeStamp] => 2016-06-03 09:13:53
        [enabled] => 1
        [loginHash] => 
        [employeeNumber] => 0007
        [userphoneNumber] => +546546546545
        [jobTitle] => Business Manager
    )

[_references:protected] => Array
    (
        [role] => Array
            (
                [referenceClass] => Application_Model_Role
                [referenceId] => 4
                [mapperClass] => Application_Model_RoleMapper
                [mapper] => 
            )

        [organisation] => Array
            (
                [referenceClass] => Application_Model_Organisation
                [referenceId] => 1
                [mapperClass] => Application_Model_OrganisationMapper
                [mapper] => 
            )

    )

我该如何获取?

2 个答案:

答案 0 :(得分:0)

之后的ajax中的.phtml文件中
     success: function(response){    
     var data = jQuery.parseJSON(response);
     for (var i in data)
     {
       var referenceId = data[i]['referenceId'];
     }
     }

答案 1 :(得分:0)

您可以使用吸气剂。您可以创建一个方法来返回referenceId。