Home  >  Article  >  Backend Development  >  Please choose the correct text editing software for PHP programming_PHP tutorial

Please choose the correct text editing software for PHP programming_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:58:24763browse

If after you modify any PHP file:

You cannot log in or out;
A blank line appears at the top of the page;
An error warning appears at the top of the page;
Other abnormal situations.
It’s probably an editor problem.

This program uses UTF-8 encoding. Almost all text editing software now can display and edit UTF-8 encoded files. But unfortunately, many of them don't perform well.

Software like Notepad that comes with Windows, when saving a file encoded in UTF-8, will insert three invisible characters (0xEF 0xBB 0xBF, or BOM) at the beginning of the file. It is a string of hidden characters used to let editors such as Notepad identify whether the file is encoded in UTF-8. For ordinary files, this will not cause any trouble. But for PHP, BOM is a problem.

PHP does not ignore the BOM, so when reading, including or referencing these files, the BOM will be used as part of the beginning text of the file. According to the characteristics of embedded languages, this string of characters will be executed (displayed) directly. As a result, even if the top padding of the page is set to 0, the entire web page cannot be placed close to the top of the browser, because there are these 3 characters at the beginning of the html!

The biggest trouble is not this. Due to the limitations of the COOKIE sending mechanism, in files that already have a BOM at the beginning of these files, the COOKIE cannot be sent (because PHP has already sent the file header before the COOKIE is sent), so the login and logout functions are invalid. All functions that rely on COOKIE and SESSION are invalid.

Therefore, when editing or changing any text file, please be sure to use an editor that does not add BOM randomly. Editors under Linux should not have this problem. Under WINDOWS, please 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' related options);
Dreamweaver (need to cancel the 'Add BOM' related options)
Wait.

For files that have added BOM, if you want to cancel, you can use the above editor to save it once. (Editplus needs to save as gb first, then save as UTF-8)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317573.htmlTechArticleIf you modify any PHP file and it happens: You cannot log in or log out; A blank line appears at the top of the page; Page An error warning appears; other abnormal conditions occur. It's probably the editor...
Statement:
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