我目前正在编写一个 PHP 函数,但是在执行完整的脚本时出现错误:
错误:
Call to undefined function mb_convert_encoding()
我的功能:
function cleanData(&$str)
{
if($str == 't') $str = 'TRUE';
if($str == 'f') $str = 'FALSE';
if(preg_match("/^0/", $str) || preg_match("/^\+?\d{8,}$/", $str) || preg_match("/^\d{4}.\d{1,2}.\d{1,2}/", $str)) {
$str = "'$str";
}
if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"';
$str = mb_convert_encoding($str, 'ISO-8859-1','utf-8');
}
谁能看出我哪里出错了。非常感谢您的宝贵时间。
干杯
最佳答案
您需要安装 extension .这取决于您的操作系统,以下是一些示例:
sudo apt-get install php-mbstring # Debian, Ubuntu
sudo yum install php-mbstring # RedHat, Fedora, CentOS
关于php - mb_convert_encoding 错误 : Call to undefined function mb_convert_encoding(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37441150/