A5下载 - 努力做内容最丰富最安全的下载站!

A5站长下载站

当前位置:A5下载 > 源码技巧 > wordpress > WordPress 提示Fatal error: Call to undefined function mb_strimwidth()

WordPress 提示Fatal error: Call to undefined function mb_strimwidth()

时间:2015-05-19 14:13作者:sa人气:298

WordPress 提示Fatal error: Call to undefined function mb_strimwidth() in category.php on line 27,原因PHP没有启用mb_strimwidth函数。

解决方法如下:

打开php.ini,找到如下代码:

extension=php_mbstring.dll,

去掉前面的分号保存,重启IIS或PHP即可。

如果上面方法不能解决可参考,在谷歌了一阵后终于找到了一个完美的解决方案,本来没有mb_strimwidth函数打开wordpress首页时是肯定会出现:

Fatal error: Call to undefined function: mb_strimwidth() 错误在index.php第17行,这样的提示的,然后打开正在使用的wordpress模板的index.php后第17行会发现如下一段,代码如下:

<?php
echo dm_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 290,"..."); ?>

//将其更改为如下代码:

<?php
echo ok_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 290,"...");

?>

那么 ok_strimwidth这个函数在这里是调用了,可是存在哪呢?别着急,打开wordpress的 wp-includes目录会有一个functions.php,在里面增加如下代码:

functionok_strimwidth($str ,$start , $width ,$trimmarker ){
$output = preg_replace('/^(?:[x00-x7F]|[xC0-xFF][x80-xBF]+){0,'.$start.'}((?:[x00-x7F]|[xC0-xFF][x80-xBF]+){0,'.$width.'}).*/s','1',$str);

return $output.$trimmarker;

}

这样就定义了 ok_strimwidth函数,现在打开你的首页看看是不是正常了?

标签WordPress,提示,Fatal,error,Call

相关下载

查看所有评论+

网友评论

网友
您的评论需要经过审核才能显示

热门阅览

最新排行

公众号