duanjiebian6712 2015-10-30 16:50
浏览 130
已采纳

Wordpress:在l10n.php中要求wp-blog-header“类LocaleMap的对象无法转换为字符串”

I'm trying to add a wordpress blog to a company website. I've got my website files in the folder mySite in rootFolder. I've installed wordpress in another folder called wordpress in that same rootFolder. Using xampp I have changed DocumentRoot & < Directory> in httpd.config from htdocs to my rootFolder.

I've created a new file called blog.php in the mySite folder. When I try to run <?php require('../wordpress/wp-blog-header.php');?> on my blog page (localhost/mySite/blog) I get this error message:

Catchable fatal error: Object of class LocaleMap could not be converted to string in C:\ (...)ootFolder\wordpress\wp-includes\l10n.php on line 558

The relevant code in l10n.php looks like this:

function load_default_textdomain( $locale = null ) {
if ( null === $locale ) {
    $locale = get_locale();
}

// Unload previously loaded strings so we can switch translations.
unload_textdomain( 'default' );

$return = load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo" );

The last line being from where the fatal error originates, apparently.

I have no idea what the problem is here. Is it about the language settings or does it have something to do with the linking of the wp-blog-header.php? Or something else entirely?

  • 写回答

1条回答 默认 最新

  • dongzanghua8422 2015-11-08 13:45
    关注

    Okay, I've solved it. It was one of our own global variables (used on the site) with the same name that replaced the $locale which wp-blog-header was looking for. Once I changed our own variable's name, things started working.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件