2012-11-21 150 views
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 
) 

在此先感謝

回答

0

使用的命名空間的System.Reflection,請嘗試使用的PropertyInfo []信息= stdClass.GetProperies(),則剛剛經歷的每個屬性循環,並檢查調試模式的價值。

+0

u能請一個示例演示如何使用命名空間解釋說,一個 –

+0

的PropertyInfo [] myPropertyInfo; //獲取'Type'類對象的屬性。 myPropertyInfo = .GetProperties(); (int i = 0; i GiantHornet

+0

供您參考,http://msdn.microsoft.com/en-us/library/aky14axb.aspx – GiantHornet

相關問題