Simple example of PHP filtering BOM data in the page
Release: 2016-07-25 08:51:25
Original
1281 people have browsed it
-
/**
- * Filter the bom in the page
- * edit bbs.it-home.org
- */
- function checkBOM ($filename) {
- $contents = file_get_contents($filename);
- $charset[1] = substr($contents, 0, 1);
- $charset[2] = substr($contents, 1, 1);
- $charset[3] = substr($contents, 2, 1);
- if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) {
- $rest = substr($contents, 3);
- rewrite $rest;
- }else{
- return false;
- }
- }
- ?>
复制代码
|
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
Latest Articles by Author
-
2024-09-09 08:30:32
-
2024-09-09 06:41:13
-
2024-09-09 06:40:13
-
2024-09-09 06:36:44
-
2024-09-09 06:36:32
-
2024-09-09 06:36:07
-
2024-09-09 06:36:02
-
2024-09-09 06:35:31
-
2024-09-09 06:35:09
-
2024-09-09 06:35:02