Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP致命错误:未捕获错误:无法将stdClass类型的对象用作数组_Php_Arrays - Fatal编程技术网

PHP致命错误:未捕获错误:无法将stdClass类型的对象用作数组

PHP致命错误:未捕获错误:无法将stdClass类型的对象用作数组,php,arrays,Php,Arrays,我目前正试图从下面发布的代码中获取ID Array ( [0] => stdClass Object ( [extraData] => stdClass Object ( [temporaryUrlDomain] => stackstaging.com [welcomeEmailRef] => 646883

我目前正试图从下面发布的代码中获取ID

    Array
(
    [0] => stdClass Object
        (
            [extraData] => stdClass Object
                (
                    [temporaryUrlDomain] => stackstaging.com
                    [welcomeEmailRef] => 646883
                )

            [id] => 10954
            [label] => Linux Unlimited
            [limits] => stdClass Object
                (
                    [domainContacts] => 1
                    [dns] => 1
                    [domainPrivacy] => 1
                    [nameservers] => 1
                    [pushTransfer] => 
                    [whois] => 1
                    [canSetQuotaNotification] => 
                    [dkimSignatures] => 
                    [highEmailNotification] => 0
                    [imapSync] => 1
                    [lowEmailNotification] => 0
                    [mailAutoresponders] => INF
                    [mailboxes] => INF
                    [mailCatchAllForwarders] => 1
                    [mailForwarders] => INF
                    [mailJunkFilterLogs] => 1
                    [mailJunkFilters] => 1
                    [maxMailboxSize] => 10240
                    [webmail] => 
                    [accessErrorLogs] => 1
                    [accountSummary] => 1
                    [additionalFtpUsers] => INF
                    [allowExternalSsl] => 1
                    [apps] => stdClass Object
                        (
                            [abantecart] => 1
                            [agoracart] => 1
                            [b2evolution] => 1
                            [buddypress] => 1
                            [cakephp] => 1
                            [cmsmadesimple] => 1
                            [concrete5] => 1
                            [coppermine] => 1
                            [craftcms] => 1
                            [craftysyntax] => 1
                            [dolphin] => 1
                            [dotproject] => 1
                            [drupal] => 1
                            [e107] => 1
                            [elgg] => 1
                            [fengoffice] => 1
                            [fluxbb] => 1
                            [formtools] => 1
                            [geeklog] => 1
                            [helpcenterlive] => 1
                            [iqdesk] => 1
                            [joomla] => 1
                            [limesurvey] => 1
                            [magento] => 1
                            [mambocms] => 1
                            [mantisbt] => 1
                            [matomo] => 1
                            [mediawiki] => 1
                            [modx] => 1
                            [moodle] => 1
                            [nucleus] => 1
                            [opencart] => 1
                            [openwebanalytics] => 1
                            [oscommerce] => 1
                            [osticket] => 1
                            [phpbb] => 1
                            [phpcoin] => 1
                            [phpformgenerator] => 1
                            [phpfreechat] => 1
                            [phpfusion] => 1
                            [phplist] => 1
                            [phpmyfaq] => 1
                            [phpnuke] => 1
                            [phprojekt] => 1
                            [piwigo] => 1
                            [prestashop] => 1
                            [prosper202] => 1
                            [reviveadserver] => 1
                            [roundcube] => 1
                            [serendipity] => 1
                            [silverstripecms] => 1
                            [simplemachinesforum] => 1
                            [slim] => 1
                            [squirrelmail] => 1
                            [sugarcrm] => 1
                            [tcexam] => 1
                            [textpattern] => 1
                            [troubleticketexpress] => 1
                            [typo3] => 1
                            [webcalendar] => 1
                            [wordpress] => 1
                            [zencart] => 1
                        )

                    [allFutureOneClick] => 
                    [awstats] => 1
                    [backups] => 1
                    [bandwidth] => INF
                    [blockVisitors] => 1
                    [cdnCaching] => 
                    [cdnOptimisation] => 
                    [cdnStatistics] => 
                    [customDocRoot] => 1
                    [customPrimaryDocRoot] => 
                    [directoryIndexing] => 1
                    [emailSummary] => 1
                    [fileManager] => 1
                    [filePermissions] => 
                    [freeSsl] => 1
                    [ftp] => 1
                    [googleTranslate] => 1
                    [hotlinkProtection] => 1
                    [mailDistributionLists] => INF
                    [malwareScan] => 
                    [manageAppPool] => 
                    [manageWpAdminUsers] => 
                    [manageWpChecksumReport] => 
                    [manageWpDatabase] => 1
                    [manageWpPlugins] => 
                    [manageWpSearchReplace] => 
                    [manageWpSiteSettings] => 
                    [manageWpStaging] => 
                    [manageWpThemes] => 
                    [manageWpUpdates] => 
                    [manageWpUsers] => 
                    [mysqlDatabases] => INF
                    [names] => 1
                    [nameserverCheck] => 1
                    [passwordProtectedDirectories] => 1
                    [phpConfig] => 1
                    [phpMyAdmin] => 1
                    [platformReinstall] => 1
                    [primaryFtpUnlock] => 1
                    [remoteMysql] => 1
                    [scheduledTasks] => 1
                    [sitemapGenerator] => 
                    [ssh] => 1
                    [statsBandwidth] => 
                    [statsDisk] => 
                    [switchPhpVersion] => 1
                    [temporaryURL] => 1
                    [timelineBackups] => 1
                    [usageInformation] => 
                    [webBuilder] => 1
                    [webRedirect] => 1
                    [webalizer] => 1
                    [webspace] => INF
                    [wpAdmin] => 
                    [domains] => 0
                    [subdomains] => 0
                    [mssqlDatabases] => INF
                    [bamboo] => 
                    [cdnCachin] => 
                )

            [platform] => linux
            [installApps] => Array
                (
                )

            [welcomeEmail] => Content-Type: text/html
Subject: Welcome To Your New Hosting
From: noreply@cloud-munch.com

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>&#8203;&#8203;</p>
<table style="font-family: 'Segoe UI', 'Segoe WP', 'Segoe UI WPC', Tahoma, Arial, sans-serif; color: #555;" border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#e9ecef">
<tbody>
<tr>
<td>&#160;</td>
</tr>
<tr>
<td align="center" valign="top">&#8203;&#8203;&#8203;&#8203;
<table border="0" width="600" cellspacing="0" cellpadding="20">
<tbody>
<tr>
<td align="center">{%if brand.hasLogo and brand.primaryBrandUrl %}<img src="{{brand.primaryBrandUrl}}/brandLogo" height="50" />{%endif%}
<h1>{% if brand.brandName %}{{brand.brandName}}{%endif%}</h1>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#fff">&#8203;
<p>Hi{% if contact.person_name %} {{contact.person_name}}{% endif %},</p>
<p>Welcome to your new web hosting with {% if brand.businessName %}{{brand.businessName}}{% else %}Us{% endif %}.</p>
<p>This email contains important information about your hosting account, so we recommend that you save it for future reference.</p>
<p>&#160;</p>
<p><strong>Your Hosting</strong></p>
<p>Domain Name: {{primarydomain}}</p>
<p>Account Setup Date: {{datecreated}}</p>
<p>Web Hosting Package Type: {{packagetype}}</p>
<p>&#160;</p>
<p><strong>{% if brandname %}{{brandname}}{% else %}StackCP{% endif %} Control Panel</strong>&#160;</p>
<p>Username: {{primarydomain}}</p>
<p>Password: {{password}}&#160;</p>
<p>Control Panel Login: <a href="{{brand.cpurl}}">{{brand.cpurl}}</a></p>
<p>&#160;</p>
<p><strong>FTP</strong></p>
<p>Username: {{ftpusername}}&#160;</p>
<p>Password: {{password}}&#160;</p>
<p>Server: {{ftpserver}}</p>
<p>To transfer your your website files, you can use FTP.</p>
<p>This needs to be unlocked first.&#160;</p>
<p>You can do this in {% if brandname %}{{brandname}}{% else %}StackCP{% endif %}, using these credentials:</p>
<p>&#160;</p>
<p><strong>Email</strong></p>
<p>Incoming Mail Server: {{mailserver}}&#160;</p>
<p>Outgoing Mailserver: {{mailserver}}&#160;</p>
<p>Webmail URL: <a href="{{webmailurl}}">{{webmailurl}}</a></p>
<p>&#160;</p>
<p>You can configure your email by logging in to {% if brandname %}{{brandname}}{% else %}StackCP{% endif %}, and selecting &#8220;Email accounts&#8221;</p>
<p>{% if brand.supportUrl and brand.supportEmailAddress %}If you have any issues, please go to {{ brand.supportUrl }} or email us at: {{ brand.supportEmailAddress }}{% endif %}</p>
<p>Thanks for your business.</p>
<p>{% if businessname %}{{businessname}}{% endif %}</p>
</td>
</tr>
<tr>
<td style="font-size: 10pt;" align="center">{% if brand.socialMedia.twitter %}<a href="https://twitter.com/{{brand.socialMedia.twitter}}"><img src="{{brand.primaryBrandUrl}}/assets/images/email/social-media/twitter.png" alt="Twitter" width="32" height="32" /></a>{% endif %} {% if brand.socialMedia.facebook %}<a href="https://facebook.com/{{brand.socialMedia.facebook}}"><img src="{{brand.primaryBrandUrl}}/assets/images/email/social-media/facebook.png" alt="Facebook" width="32" height="32" /></a>{% endif %} {% if brand.socialMedia.instagram %}<a href="https://www.instagram.com/{{brand.socialMedia.instagram}}"><img src="{{brand.primaryBrandUrl}}/assets/images/email/social-media/instagram.png" alt="Instagram" width="32" height="32" /></a>{% endif %} {% if brand.socialMedia.youtube %}<a href="https://www.youtube.com/{{brand.socialMedia.youtube}}"><img src="{{brand.primaryBrandUrl}}/assets/images/email/social-media/youtube.png" alt="YouTube" width="32" height="32" /></a>{% endif %} {% if brand.socialMedia.linkedin %}<a href="https://www.linkedin.com/{{brand.socialMedia.linkedin}}"><img src="{{brand.primaryBrandUrl}}/assets/images/email/social-media/linkedin.png" alt="Linkedin" width="32" height="32" /></a>{% endif %}</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>&#160;</td>
</tr>
</tbody>
</table>
</body>
</html>
            [passwordResetEmail] => 
        )

    [1] => stdClass Object
        (
            [extraData] => stdClass Object
                (
                    [temporaryUrlDomain] => 
                    [welcomeEmailRef] => 
                )

            [id] => 10955
            [label] => Windows Unlimited
            [limits] => stdClass Object
                (
                    [dns] => 1
                    [nameservers] => 1
                    [whois] => 1
                    [imapSync] => 1
                    [mailAutoresponders] => INF
                    [mailboxes] => INF
                    [mailCatchAllForwarders] => 1
                    [mailForwarders] => INF
                    [mailJunkFilterLogs] => 1
                    [mailJunkFilters] => 1
                    [maxMailboxSize] => 10240
                    [accessErrorLogs] => 1
                    [accountSummary] => 1
                    [additionalFtpUsers] => INF
                    [allowExternalSsl] => 1
                    [apps] => stdClass Object
                        (
                            [abantecart] => 1
                            [agoracart] => 1
                            [b2evolution] => 1
                            [buddypress] => 1
                            [cakephp] => 1
                            [cmsmadesimple] => 1
                            [concrete5] => 1
                            [coppermine] => 1
                            [craftcms] => 1
                            [craftysyntax] => 1
                            [dolphin] => 1
                            [dotproject] => 1
                            [drupal] => 1
                            [e107] => 1
                            [elgg] => 1
                            [fengoffice] => 1
                            [fluxbb] => 1
                            [formtools] => 1
                            [geeklog] => 1
                            [helpcenterlive] => 1
                            [iqdesk] => 1
                            [joomla] => 1
                            [limesurvey] => 1
                            [magento] => 1
                            [mambocms] => 1
                            [mantisbt] => 1
                            [mediawiki] => 1
                            [modx] => 1
                            [moodle] => 1
                            [nucleus] => 1
                            [opencart] => 1
                            [openwebanalytics] => 1
                            [oscommerce] => 1
                            [osticket] => 1
                            [phpbb] => 1
                            [phpcoin] => 1
                            [phpformgenerator] => 1
                            [phpfreechat] => 1
                            [phpfusion] => 1
                            [phplist] => 1
                            [phpmyfaq] => 1
                            [phpnuke] => 1
                            [phprojekt] => 1
                            [piwigo] => 1
                            [prestashop] => 1
                            [prosper202] => 1
                            [reviveadserver] => 1
                            [roundcube] => 1
                            [serendipity] => 1
                            [silverstripecms] => 1
                            [simplemachinesforum] => 1
                            [slim] => 1
                            [squirrelmail] => 1
                            [statusnet] => 1
                            [sugarcrm] => 1
                            [tcexam] => 1
                            [textpattern] => 1
                            [tomatocart] => 1
                            [troubleticketexpress] => 1
                            [typo3] => 1
                            [webcalendar] => 1
                            [wordpress] => 1
                            [zencart] => 1
                            [matomo] => 1
                        )

                    [awstats] => 1
                    [backups] => 1
                    [bandwidth] => INF
                    [blockVisitors] => 1
                    [customDocRoot] => 1
                    [directoryIndexing] => 1
                    [domainContacts] => 1
                    [domainPrivacy] => 1
                    [emailSummary] => 1
                    [fileManager] => 1
                    [freeSsl] => 1
                    [ftp] => 1
                    [googleTranslate] => 1
                    [hotlinkProtection] => 1
                    [mailDistributionLists] => INF
                    [manageAppPool] => 1
                    [manageWpDatabase] => 1
                    [mssqlDatabases] => INF
                    [mysqlDatabases] => INF
                    [nameserverCheck] => 1
                    [names] => 1
                    [passwordProtectedDirectories] => 1
                    [platformReinstall] => 1
                    [phpConfig] => 1
                    [phpMyAdmin] => 1
                    [primaryFtpUnlock] => 1
                    [remoteMysql] => 1
                    [scheduledTasks] => 1
                    [ssh] => 1
                    [switchPhpVersion] => 1
                    [temporaryURL] => 1
                    [timelineBackups] => 1
                    [webalizer] => 1
                    [webBuilder] => 1
                    [webRedirect] => 1
                    [webspace] => INF
                    [malwareScan] => 
                    [manageWpPlugins] => 
                    [manageWpThemes] => 
                    [manageWpUsers] => 
                    [manageWpAdminUsers] => 
                    [manageWpSiteSettings] => 
                    [manageWpStaging] => 
                    [manageWpChecksumReport] => 
                    [manageWpSearchReplace] => 
                    [manageWpUpdates] => 
                    [filePermissions] => 
                    [bamboo] => 
                    [sitemapGenerator] => 
                    [cdnCachin] => 
                    [cdnOptimisation] => 
                    [cdnCaching] => 
                    [cdnStatistics] => 
                )

            [platform] => windows
            [installApps] => Array
                (
                )

            [welcomeEmail] => 
            [passwordResetEmail] => 
        )

    [2] => stdClass Object
        (
            [extraData] => stdClass Object
                (
                    [temporaryUrlDomain] => 
                    [welcomeEmailRef] => 
                )

            [id] => 10956
            [label] => WordPress Unlimited
            [limits] => stdClass Object
                (
                    [dns] => 1
                    [nameservers] => 1
                    [whois] => 1
                    [imapSync] => 1
                    [mailAutoresponders] => INF
                    [mailboxes] => INF
                    [mailCatchAllForwarders] => 1
                    [mailForwarders] => INF
                    [mailJunkFilterLogs] => 1
                    [mailJunkFilters] => 1
                    [maxMailboxSize] => 10240
                    [accessErrorLogs] => 1
                    [accountSummary] => 1
                    [additionalFtpUsers] => INF
                    [allowExternalSsl] => 1
                    [apps] => stdClass Object
                        (
                            [abantecart] => 1
                            [agoracart] => 1
                            [b2evolution] => 1
                            [buddypress] => 1
                            [cakephp] => 1
                            [cmsmadesimple] => 1
                            [concrete5] => 1
                            [coppermine] => 1
                            [craftcms] => 1
                            [craftysyntax] => 1
                            [dolphin] => 1
                            [dotproject] => 1
                            [drupal] => 1
                            [e107] => 1
                            [elgg] => 1
                            [fengoffice] => 1
                            [fluxbb] => 1
                            [formtools] => 1
                            [geeklog] => 1
                            [helpcenterlive] => 1
                            [iqdesk] => 1
                            [joomla] => 1
                            [limesurvey] => 1
                            [magento] => 1
                            [mambocms] => 1
                            [mantisbt] => 1
                            [mediawiki] => 1
                            [modx] => 1
                            [moodle] => 1
                            [nucleus] => 1
                            [opencart] => 1
                            [openwebanalytics] => 1
                            [oscommerce] => 1
                            [osticket] => 1
                            [phpbb] => 1
                            [phpcoin] => 1
                            [phpformgenerator] => 1
                            [phpfreechat] => 1
                            [phpfusion] => 1
                            [phplist] => 1
                            [phpmyfaq] => 1
                            [phpnuke] => 1
                            [phprojekt] => 1
                            [piwigo] => 1
                            [prestashop] => 1
                            [prosper202] => 1
                            [reviveadserver] => 1
                            [roundcube] => 1
                            [serendipity] => 1
                            [silverstripecms] => 1
                            [simplemachinesforum] => 1
                            [slim] => 1
                            [squirrelmail] => 1
                            [statusnet] => 1
                            [sugarcrm] => 1
                            [tcexam] => 1
                            [textpattern] => 1
                            [tomatocart] => 1
                            [troubleticketexpress] => 1
                            [typo3] => 1
                            [webcalendar] => 1
                            [wordpress] => 1
                            [zencart] => 1
                            [matomo] => 1
                        )

                    [awstats] => 1
                    [backups] => 1
                    [bandwidth] => INF
                    [blockVisitors] => 1
                    [customDocRoot] => 1
                    [directoryIndexing] => 1
                    [domainContacts] => 1
                    [domainPrivacy] => 1
                    [emailSummary] => 1
                    [fileManager] => 1
                    [freeSsl] => 1
                    [ftp] => 1
                    [googleTranslate] => 1
                    [hotlinkProtection] => 1
                    [mailDistributionLists] => INF
                    [manageAppPool] => 1
                    [manageWpDatabase] => 1
                    [mssqlDatabases] => INF
                    [mysqlDatabases] => INF
                    [nameserverCheck] => 1
                    [names] => 1
                    [passwordProtectedDirectories] => 1
                    [platformReinstall] => 1
                    [phpConfig] => 1
                    [phpMyAdmin] => 1
                    [primaryFtpUnlock] => 1
                    [remoteMysql] => 1
                    [scheduledTasks] => 1
                    [ssh] => 1
                    [switchPhpVersion] => 1
                    [temporaryURL] => 1
                    [timelineBackups] => 1
                    [webalizer] => 1
                    [webBuilder] => 1
                    [webRedirect] => 1
                    [webspace] => INF
                    [malwareScan] => 
                    [manageWpPlugins] => 
                    [manageWpThemes] => 
                    [manageWpUsers] => 
                    [manageWpAdminUsers] => 
                    [manageWpSiteSettings] => 
                    [manageWpStaging] => 
                    [manageWpChecksumReport] => 
                    [manageWpSearchReplace] => 
                    [manageWpUpdates] => 
                    [filePermissions] => 
                    [bamboo] => 
                    [sitemapGenerator] => 
                    [cdnCachin] => 
                    [cdnOptimisation] => 
                    [cdnCaching] => 
                    [cdnStatistics] => 
                )

            [platform] => wordpress
            [installApps] => Array
                (
                )

            [welcomeEmail] => 
            [passwordResetEmail] => 
        )

)
我得到以下错误


致命错误:未捕获错误:无法在第15行的/home/sites/10a/6/6dc3805467/public_html/hosting api/api/lib/getid.php中使用stdClass类型的对象作为数组。php:15堆栈跟踪:#0{main}抛出/home/sites/10a/6/6dc3805467/public_html/hosting api/api/lib/getid.php当访问对象时,我们使用'->',您使用的方式是访问数组键

请尝试使用以下代码

echo $domains[0]->id;

域是一个对象数组,因此我们使用上述方法访问键及其值。

尝试
echo$domains[0]->id
,因为它是一个对象数组。我建议您学习PHP数组教程。你需要基本的基础。请问谷歌这能回答你的问题吗?谢谢你的帮助,我用echo$domains[0]->id:)得到了它,这就是你投票给评论help@Andrew的时候了
echo $domains[0]->id;