bindtextdomain php,php bindtextdomain失败

我试图在运行php 7.1的CentOS服务器上用php设置国际化。

这是我的目录结构:

/home/project/public_html/locale/japanese/LC_MESSAGES/messages.po

/home/project/public_html/locale/japanese/LC_MESSAGES/messages.mo

/home/project/public_html/index.php

messages.po包含行(以及其他行):

"Language: japanese\n"

"Content-Type: text/plain; charset=UTF-8\n"

我有以下代码:

$check_putenv = putenv("LC_ALL=japanese");

if (!$check_putenv) {

echo "Warning: putenv LC_ALL failed!\n";

}

$check_putenv2 = putenv("LANGUAGE=japanese");

if (!$check_putenv2) {

echo "Warning: putenv LANGUAGE failed!\n";

}

$check_locale = setlocale(LC_MESSAGES, 'japanese');

if (!$check_locale) {

echo "Warning: Failed to set locale japanese!\n";

}

$check_bind = bindtextdomain("messages", "/home/project/public_html/locale");

if (!$check_bind) {

echo "Warning: Failed to bind text domain!\n";

}

$check_textdomain = textdomain("messages");

if ($check_textdomain !== "messages") {

echo "Warning: Failed to set text domain!\n";

}

输出是

Warning: Failed to bind text domain!

区域设置-返回(以及其他)

ja_JP

ja_JP.utf8

japanese

知道会出什么问题吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值