Charset=utf8 not working in my PHP page(Charset=utf8 在我的 PHP 页面中不起作用)
问题描述
我的字符编码有问题.每当我在浏览器中加载页面时,它显示如下:
所以我需要通过浏览器手动配置它.感谢您的帮助.
听起来您的内容并未以 utf-8 格式提供.通过设置正确的标题来做到这一点:
<块引用>header('Content-type: text/html; charset=utf-8');除了确保浏览器理解之外,添加一个元标记:
<块引用><meta http-equiv="Content-type" content="text/html; charset=utf-8"/>请注意,根据文本的来源,您可能还需要检查其他一些内容(数据库连接、源文件编码等) - 我在 我对类似问题的回答之一.
I got a problem with my character encoding. Whenever I load a page in the browser, It shows like this:
So I need to manually configure it by the browser. Thanks for your help.
sounds like you don't serve your content as utf-8. do this by setting the correct header:
header('Content-type: text/html; charset=utf-8');
in addition to be really sure the browser understands, add a meta-tag:
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
note that, depending on where the text comes from, you might have to check some other things too (database-connection, source-file-encoding, ...) - i've listed a lot of them in one of my answers to a similar question.
这篇关于Charset=utf8 在我的 PHP 页面中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Charset=utf8 在我的 PHP 页面中不起作用
基础教程推荐
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何替换eregi() 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
