stdClass Object
(
[ModuleAccountInfo] => Array
(
[0] => stdClass Object
(
[ServerName] => EAST
[HostingModule] => ActiveDirectory
[ActiveDirectorySiteName] => EAST
[AccountIdentity] => OU=ndla,OU=Hosting,DC=east,DC=domain,DC=local
[Groups] => 2
[Users] => 15
)
[1] => stdClass Object
(
[ServerName] => EAST.net
[HostingModule] => hange
[DiskQuota] => 375000
[DiskQuotaAdditional] => 0
[DateQuotaExceeded] => 0001-01-01T00:00:00
[DiskSpace] => 58567
[MailboxesDiskSpace] => 59973051
[PublicFoldersDiskSpace] => 0
[MessageArchivingDiskSpace] => 0
[Contacts] => 8
[Mailboxes] => 15
如何访问ServerName属性? 该对象保存在$ modules变量中。以上是$ modules的print_r。
答案 0 :(得分:10)
因为ModuleAccountInfo
属性是一个数组,所以你需要使用特定的索引
echo $modules->ModuleAccountInfo[0]->ServerName;
或循环
foreach ($modules->ModuleAccountInfo as $moduleAccountInfo) {
echo $moduleAccountInfo->ServerName;
}