Home Backend Development PHP Tutorial “UTF-8的BOM头信息输出” 这句话是什么意思啊该如何处理

“UTF-8的BOM头信息输出” 这句话是什么意思啊该如何处理

Jun 13, 2016 pm 01:14 PM
bom header php session

“UTF-8的BOM头信息输出” 这句话是什么意思啊
“UTF-8的BOM头信息输出” 这句话是什么意思啊

------解决方案--------------------
utf-8编码的头部默认会有二个特殊字符,这二个特殊字符就是bom
------解决方案--------------------
看看这个解释:
http://hi.baidu.com/%CE%D2%B5%C4%B5%C6%C5%DD%C1%C1%C1%CB/blog/item/9c1660ee5db2b03cadafd5e7.html
------解决方案--------------------
我记得PHP如果存为UTF-8 BOM格式的话,页面顶端会多出一行空行(至少我当时在IE8下是这样)
------解决方案--------------------
所以你会喜欢notepad++的
------解决方案--------------------
保存utf-8PHP文件的时候,最好不要以UTF-8的BOM头方式保存。
否则你在程序里,使用session,header,以及压缩输出的时候都会出错。
BOM头只是一个文件标识,是加在文件最开始的地方。用普通编辑器是看不见的,但它又是的确存在,也会在一开始就输出的。就是因为它在头部,且一开始就会输出,就会导致使用session,header,以及压缩输出的时候出错

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

CakePHP Date and Time

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

CakePHP File upload

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

CakePHP Project Configuration

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

CakePHP Routing

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

Discuss CakePHP

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP Quick Guide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

How To Set Up Visual Studio Code (VS Code) for PHP Development

See all articles