调用未定义的函数mb

调用未定义的函数mb

本文介绍了调用未定义的函数mb_strimwidth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月前,我编写了一个简短的代码,该代码使用mb_strimwidth()来将某些文本恰好适合表格单元格,将点放在截断字符串的末尾.现在,一段时间后,我尝试执行相同的代码,但此错误消失了:

Months ago I made a short code that uses mb_strimwidth() to exactly fit some text into a table cell, putting dots at the end of a truncated string.Now, after some times, I tried to execute that same code and it went out with this error:

Fatal error: Call to undefined function mb_strimwidth() in ...

我试图找到mbstring.php文件,当我找到mb_strimwidth()函数时,我发现它不再实现了.那怎么可能?但是我的主要问题是:如何获得与mb_strimwidth()相同的结果?我以为可以使用循环和mb_strwidth()重写该函数,但是该mbst​​ring.php文件中的所有函数都是空的.

I tried to find the mbstring.php file, and when I found the mb_strimwidth() function, I discovered that it is not implemented anymore. How is that possible?But my main question is: how can I get the same result as mb_strimwidth()?I thought to rewrite the function using a loop and mb_strwidth(), but ALL the functions in that mbstring.php file are empty.

推荐答案

所有mb_*函数均由名为Multibyte String的PHP扩展提供,内部扩展名为 mbstring

All mb_* functions are provided by a PHP extension called Multibyte String, internal name mbstring

您可能没有激活或未安装扩展.在大多数Linux发行版中,您可以安装软件包php-mbstring来安装和激活此扩展.

You probably don't have the extension active or installed. On most Linux distros you can install the package php-mbstring to install and activate this extension.

如果您使用的是mod_php,则之后需要重新启动Apache

Apache needs to be restarted afterwards if you are using mod_php

这篇关于调用未定义的函数mb_strimwidth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 05:38