How to display Japanese characters on a php page?(如何在php页面上显示日文字符?)
问题描述
我正在尝试在 PHP 页面上显示日语字符.没有从数据库加载,只是存储在一个语言文件中并被回显.
I'm trying to display Japanese characters on a PHP page. No loading from the database, just stored in a language file and echo'ed out.
我遇到了一个奇怪的场景.我使用 UTF-8 正确设置了页面,并在我的本地 WAMP 服务器上测试了一个示例页面,它可以正常工作.
I'm running into a weird scenario. I have the page properly setup with UTF-8 and I test a sample page on my local WAMP server and it works.
当我测试我们的开发和生产服务器时,字符显示不正确.
The moment I tested it out our development and production servers the characters don't display properly.
这让我相信这是 php.ini 中的一个设置.但是我还没有找到太多关于此的信息,所以我不确定这是否是问题所在.
This leads me to believe then that it's a setting in php.ini. But I haven't found much information about this so I'm not really sure if this is the issue.
是不是我遗漏了一些基本的东西?
Is there something fundamental I'm missing?
谢谢
推荐答案
既然你已经声明它在你的开发环境中工作而不是在你的现场,你可能想检查 Apache 的 AddDefaultCharset 并将其设置为 UTF-8(如果尚未设置).
Since you've stated that it is working in your development environment and not in your live, you might want to check Apache's AddDefaultCharset and set this to UTF-8, if it's not already.
我倾向于确保检查以下步骤
I tend to make sure the following steps are checked
- PHP 标头以 UTF-8 格式发送
- 元标记设置为 UTF-8(内容类型)
- 存储设置为 UTF-8
- 服务器输出设置为 UTF-8
这似乎对我有用.希望这会有所帮助.
That seems to work for me. Hope this helps.
这篇关于如何在php页面上显示日文字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在php页面上显示日文字符?


- PHP Count 布尔数组中真值的数量 2021-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- Laravel 仓库 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01