2010-12-08 181 views
6

如何從此對象獲取user_nicenamePHP:從對象中獲取數據

BP_User Object 
(
    [data] => stdClass Object 
     (
      [ID] => 1 
      [user_login] => NICENICE 
      [user_pass] => $P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5. 
      [user_nicename] => NICENAME 
      ... 

我在哪裏可以找到資源來學習?

+0

呀。試過,但不知道我在找什麼。 – christina 2010-12-08 21:55:49

+0

http://www.php.net/manual/en/language.oop5.properties.php – ajreal 2010-12-08 21:59:27

回答

23
$variable->data->user_nicename 

應該工作。

3

您可以通過另一種方式進行打印,還

foreach($result->data as $newdata) //$result is variable that store raw data 
{ 
printf("name: %s, Pass: %s, nicename: %s <br/>", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); 
} 

結果將是

name:NICENICE , Pass:$P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5., nicename:NICENAME