![](/img/trans.png)
[英]PHP : How to manage “Document labelled UTF-16 but has UTF-8 content” error on simplexml_load_string()
[英]Document labelled UTF-16 but has UTF-8 content in Entity PHP error
我最近將我的網站從 PHP5.2 轉移到 PHP5.3。 我有一個身份驗證模塊,該模塊之前工作正常,但現在出現錯誤
Document labelled UTF-16 but has UTF-8 content in Entity
我嘗試用 UTF-16 替換所有出現的 UTF-8 但這沒有幫助。 此錯誤的可能解決方案/原因是什么?
看到這個:
此鏈接的解決方案只是替換 XML 代碼中的編碼信息:
$xml = $result->GetWeatherResult;
$xml = preg_replace('/(<\?xml[^?]+?)utf-16/i', '$1utf-8', $xml);
不是一個好的解決方案,但適用於 OP。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.