问题
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