0

下記のコーディングがあります。この配列からresponse_textとresponse_codeの値を取得したいと思います。誰でも特定のキー値を取得する方法を教えてくれます。

stdClass Object
(
    [_OPS_version] => 0.9
    [protocol] => XCP
    [request_response_time] => 0.441
    [response_text] => Command completed successfully
    [is_search_completed] => 1
    [action] => REPLY
    [attributes] => stdClass Object
        (
            [suggestion] => stdClass Object
                (
                    [count] => 0
                    [response_text] => Missing tld list, supported tlds are [.com,.net,.org,.info,.biz,.us,.mobi]
                    [response_code] => 500
                    [is_success] => 0
                )

        )

    [response_code] => 200
    [is_success] => 1
)

前もって感謝します

4

2 に答える 2

0

名前空間 System.Reflection を使用し、PropertyInfo[] info = stdClass.GetProperies() を使用してみてから、各プロパティをループして、デバッグ モードで値を確認します。

于 2012-11-21T06:45:53.900 に答える
0

PHPでも、以下のように値を取得できます

$check=$results->{'attributes'}->suggestion->response_text;

参照: http://bytes.com/topic/php/answers/161452-stdclass-object-get_object_vars

于 2012-11-21T07:25:34.870 に答える