Principle:
UTF8 file, in order to add identification information, Microsoft has BOM: BOM - Byte Order Mark, which is defaulted on Windows and other platforms The edited UTF8 file will add 3 bytes of tag information to the header. Our PHP engine will completely read the entire PHP code document during processing. If the PHP file header contains BOM information, a blank will be output. In many cases, Sometimes it will cause problems, such as our session cannot work, cookies cannot be set, etc.
Solution:
Recognize the 3-byte information of the header BOM and then eliminate it. However, generally we don’t know which file has a BOM, or there are many files. At this time, batch processing is needed. The following code mainly shows the batch processing situation, which should be helpful to everyone in their work.
Execution method:
Set a path and execute it directly.