我使用这段代码:
$wpCharset = "UTF8" //or any other charset
//http://php.net/manual/en/domdocument.loadhtml.php#74777
$content = mb_convert_encoding($content, 'HTML-ENTITIES', $wpCharset);
$dom = new DOMDocument('1.0', $wpCharset);
$success = $dom->loadHtml('<!DOCTYPE html><html><meta http-equiv="Content-Type" content="text/html; charset=' . $wpCharset . '" /><body>' . $content);
问题是有些用户没有在服务器上安装有效的“mbstring”扩展。在这种情况下是否有 mb_convert_encoding 的替代方案?
非常感谢