PHP gettext方法给出空响应 [英] PHP gettext method gives empty response

查看:98
本文介绍了PHP gettext方法给出空响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用php gettext方法时,例如:

When using the php gettext method like:

error_reporting(E_ALL);
gettext("string");
//OR
_("string");

服务器给出一个空响应,绝对没有输出,甚至没有错误. 注释掉这两种方法时,页面的工作都与预期的一样.

The server gives an empty response absolutely no output not even an error. When commenting both methods out the page works like expected.

Firefox:连接已重置

Firefox: The connection was reset

Chrome浏览器:未接收到数据

Chrome: No data received

Safari:{显示空白页}

Safari: {shows empty page}

我正在使用:Mac上本地最新的Zend Server,带有OSX Mavericks(10.9.1). 希望有人能提供帮助,我现在正尝试修复此问题大约2周,并且似乎没有任何效果.

I'm using: latest Zend Server locally on my Mac with OSX Mavericks (10.9.1). Hope someone can help, I'm trying to fix this for about 2 weeks now and nothing seems to work.

推荐答案

似乎在某些系统上,setlocale()不够.

Seems to be that on some systems setlocale() isn't enough.

http://nl3.php.net/manual/en/function. gettext.php

对于某些系统和putenv()而言,设置语言是不够的 应该用于定义当前语言环境.

Setting a language isn't enough for some systems and the putenv() should be used to define the current locale.

我添加时问题已解决:

putenv('LC_ALL=0');

这篇关于PHP gettext方法给出空响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆