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 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn