Why does mb_convert_encoding fail? [closed]

淺唱寂寞╮ 提交于 2019-12-13 10:02:27

问题


Why does

<?php 

echo "HELLO WORLD 1"; // shows
error_reporting(E_ALL);
echo "HELLO WORLD 2"; // shows
print_r(mb_list_encodings()); // does not show
echo "HELLO WORLD 3"; // does not show
$result = mb_convert_encoding("apple", 'UTF-8');
echo "HELLO WORLD 4"; // does not show;
echo $result; // does not show;

// no error what so ever displayed.

?>

fail? What can make this function fail?

I have a PHP web page that runs code and halts at this line, and returns HTTP 500 error.

But I don't know why it fails. Any suggestion for where to check?

Update: Error Log shows

PHP Fatal error:  Call to undefined function mb_convert_encoding()

回答1:


PHP Fatal error: Call to undefined function mb_convert_encoding()

That means mb_convert_encoding is not installed, because the MB extension is not installed on your version of PHP. How to install it depends on how you installed PHP. Mostly likely your operating system has a package manager (apt-get or such) that will allow you to install it quickly. Otherwise, see the manual.



来源:https://stackoverflow.com/questions/32325200/why-does-mb-convert-encoding-fail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!