質問

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

How do I access the ServerName properties? This object is held in a $modules variables. The above is the print_r of $modules.

役に立ちましたか?

解決

Because the ModuleAccountInfo property is an array, you'll either need to use a specific index

echo $modules->ModuleAccountInfo[0]->ServerName;

or loop

foreach ($modules->ModuleAccountInfo as $moduleAccountInfo) {
    echo $moduleAccountInfo->ServerName;
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top