簡體   English   中英

未捕獲錯誤:未找到“Google \\ AdsApi \\ Examples \\ Class \\ AdWords \\ v201809 \\ Reporting \\ DOMDocument”類

[英]Uncaught Error: Class 'Google\AdsApi\Examples\AdWords\v201809\Reporting\DOMDocument' not found

我安裝了php-xml並且使用以下代碼在其他php文件上運行良好,以在網站上顯示xml:

$doc = new DOMDocument();
$doc->loadXML(html_entity_decode($xml), LIBXML_NOXMLDECL);
echo $doc->saveXML();

但它不適用於Google AdWords報告API。 它顯然與namespace Google\\AdsApi\\Examples\\AdWords\\v201809\\Reporting; 我不熟悉PHP,並想知道如何讓這個DOMDocumentReporting命名空間內工作。 謝謝。

您需要在DOMDocument之前添加反斜杠\\以從全局命名空間加載類。 否則php會在您當前的命名空間中搜索DOMDocument類。

如果您需要更多相關信息,可能需要查看全局命名空間php文檔

$doc = new \DOMDocument();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM