php - mb_convert_encoding 错误 : Call to undefined function mb_convert_encoding()

标签 php

我目前正在编写一个 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/

相关文章:

javascript - 将 WordPress 帖子 ID 传递到另一个页面

php - 在谷歌文档查看器中显示 AWS 文件

php - 这是在 PHP mvc 中缓存查询和构建页面的可接受方式吗?

php - ClassNotFoundException : Attempted to load class "FOSUserBundle" from namespace "FOS\UserBundle"

php - Laravel:带有 INSERT(外键)的 SQL LEFT JOIN

php - 在 Symfony 2 中获取所有请求参数

php - Laravel:使用资源 Controller 更新表的单个字段

php - 如何在 REDIS 中以最有效的方式基于多个条件查询我的数据?

php - 对如何从返回一组特定值的查询中获取另一行感到困惑

php - Symfony Doctrine EntityManager 没有正确刷新