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 删除虚拟显示器驱动 删除所有 Xorg 配置文件 删除显示器缓存文件 重启系统 可是依旧无法退出虚拟显示器
  • ¥15 vscode程序一直报同样的错,如何解决?
  • ¥15 关于使用unity中遇到的问题
  • ¥15 开放世界如何写线性关卡的用例(类似原神)
  • ¥15 关于并联谐振电磁感应加热
  • ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
  • ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
  • ¥66 如何制作支付宝扫码跳转到发红包界面
  • ¥15 pnpm 下载element-plus
  • ¥15 解决编写PyDracula时遇到的问题