A blank at the top of the browser preview PHP file causes and solutions for layout Analysis _php tutorial

Source: Internet
Author: User
In the process of writing PHP files, found in the browser preview PHP files, the top will appear a line of blank, affecting the layout of the page.

the explanation of the BOM header is as follows

Typically, you write a Web program using a notepad program that comes with your Windows system, but after you write or modify your PHP blog system code, you always get the following questions as you debug:

– Cannot log in or be logged out;
– A blank appears at the top of the page;
– An error warning appears at the top of the page;
– Other abnormal conditions.

Analysis Reason
Because UTF-8 encoding is used, it is saved in the Utf-8 encoding format after the code is written or modified. Although almost all of the text editing software now can display and edit UTF-8 encoded files, unfortunately many of these software performance is not ideal.

Software such as Windows-brought Notepad, when saving a UTF-8 encoded file, inserts three invisible characters (_0xef _0xbb _0xbf, Bom--byte Order Mark) where the file begins. It is a string of hidden characters that allows editors such as Notepad to identify whether the file is encoded in UTF-8. For general files, this does not cause any trouble. But for PHP, PHP at design time does not consider the problem of the BOM, do not ignore the UTF-8 encoded file at the beginning of the BOM three characters, will be the BOM as part of the text at the beginning of the file. Because of the need to
Solutions

When editing or changing any text file, be sure to use an editor that does not mess with the BOM. The editor under Linux should not have this problem. Under Windows, do not use editors such as Notepad. The recommended editors are:
EditPlus version 2.12 or above;
EmEditor;
UltraEdit (need to cancel the ' Add BOM ' option);
Dreamweaver (need to cancel the ' Add BOM ' option);
Notepad (needs to be "converted to UTF-8 without BOM") and so on.

For a file that has already been added to the BOM, you can save it with the above editor if you want to cancel it. (EditPlus needs to be saved as GB first and then saved as UTF-8.) Dreamweaver "contains Unicode signature (BOM)" Cancellation in Page properties

http://www.bkjia.com/PHPjc/326364.html www.bkjia.com true http://www.bkjia.com/PHPjc/326364.html techarticle In the process of writing PHP files, found in the browser preview PHP files, the top will appear a line of blank, affecting the layout of the page. The explanation of the BOM header is as follows: Usually, to make ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.