あなたの問題は、mbstring拡張機能が有効になっていないことに関するものだと思います。
mb_internal_encoding関数にはmbstring拡張機能が必要です。これはnon-default拡張機能であり、デフォルトでは有効になっていません。
mb_string http://www.php.net/mbstringをインストールして構成する方法の詳細については、これを参照してください。
Windows を使用している場合はextension=php_mbstring.dll;、php.ini の行のコメントを外します (extension=php_mbstring.dll の前のセミコロンを削除します)。
Linux を使用している場合はyum install php-mbstring、centos を試すことができます。
ubuntuの場合、私は明確ではありません。
この後、apache を再起動します。
更新:
拡張機能が有効になっているかどうかを確認するには、次を使用できます。
if (extension_loaded('mbstring')) {
//functions using mb string extensions
}
新しいアップデート :
if (extension_loaded('mbstring')) {
mb_internal_encoding(get_bloginfo('charset'));
}
WordPressには、これらを処理する機能が組み込まれていると思いますwp_set_internal_encoding()。ファイルでこの関数を呼び出すだけです。wp_set_internal_encoding() が行うことは、上で説明したのと同じです:
function wp_set_internal_encoding() {
if ( function_exists( 'mb_internal_encoding' ) ) {
if ( !@mb_internal_encoding( get_option( 'blog_charset' ) ) )
mb_internal_encoding( 'UTF-8' );
}
}
が存在するかどうかをチェックしmb_internal_encoding functionます (拡張機能がロードされている場合にのみ関数が存在します)。これは、関数が存在するかどうかを確認する別の方法です。
利点は、関数のみを呼び出す必要があり、他のことを気にする必要がないことです。WordPress がそれらを処理します。
新しいアップデート :
mb_strlen最初のエラーについては、関数をfunction_exists ()
likeでラップします。
if ( function_exists( 'mb_strlen' ) ) {
mb_strlen();
}
拡張機能を有効にしていて、破損している可能性があります。そのため、それを呼び出す前に関数が存在するかどうかを確認することをお勧めします。
wp_set_internal_encoding2 番目のエラーについては、functions.php やその他のファイルにを追加する必要はありません。WordPressの組み込み機能です。関数を呼び出すだけですwp_set_internal_encoding。実際に存在する関数を宣言しています。そのため、PHP は致命的なエラーを返します。
新しいアップデート
関数には、mbstring 拡張機能が有効になっている場合にのみ機能する mb_strlen があります。だから変えればいい
function theme_trim_long_str($str, $len = 50, $sep = ' '){
$words = split($sep, $str);
$wcount = count($words);
while( $wcount > 0 && mb_strlen(join($sep, array_slice($words, 0, $wcount))) > $len) $wcount--;
if ($wcount != count($words)) {
$str = join($sep, array_slice($words, 0, $wcount)) . '…';
}
return $str;
}
に
function theme_trim_long_str($str, $len = 50, $sep = ' '){
$words = split($sep, $str);
$wcount = count($words);
if ( function_exists( 'mb_strlen' ) ) {
while( $wcount > 0 && mb_strlen(join($sep, array_slice($words, 0, $wcount))) > $len)
$wcount--;
} else {
while( $wcount > 0 && strlen(join($sep, array_slice($words, 0, $wcount))) > $len)
$wcount--;
}
if ($wcount != count($words)) {
$str = join($sep, array_slice($words, 0, $wcount)) . '…';
}
return $str;
}
これがお役に立てば幸いです:)