When a 404 error bad_url error is automatically generated when a deleted file is created, the generated txt file does not have line breaks. After being submitted to Baidu, the system prompts a format error, I will share with you the solution to this problem step by step. When a 404 error bad_url error is automatically generated when a deleted file is created, the generated txt file does not have line breaks. After being submitted to Baidu, the system prompts a format error, I will share with you the solution to this problem step by step.
Script ec (2); script
1. Analysis of incorrect practices
// Add the error page below and submit it to Baidu
The Code is as follows: |
|
$ Hand = fopen ("$ path/bad_url.txt", ""); Fwrite ($ hand, "\ r". 'HTTP: // www.111cn.net '. $ rs ['your address']); Fclose ($ hand ); |
The result shows that the output is
Http://www.111cn.net/database/mysql/57520.htm http://www.111cn.net/wy/js-ajax/57519.htm
This kind of continuity is not what I want
Http://www.111cn.net/database/mysql/57520.htm
Http://www.111cn.net/wy/js-ajax/57519.htm
I did not think about using chr (13) or chr (32) Like ascii code. I have handled the carriage return and line feed of the htm form, after the test, it still does not work. At that time, it is only a hundred degrees.
The Code is as follows: |
|
$ Stream = fopen ("robots.txt", "w + "); Fwrite ($ stream, "are you breaking the line? \ R \ n I already have a line break! "); ?>
|
Note: Do not use single quotes in the code. I am wrong in this step. If single quotes are used, the output will be User-agent: * \ r \ nDisallow: /Because the single quotes in PHP do not replace the content, double quotation marks are used, because the double quotation marks in PHP are used to check the content.
After several times, you can delete the file, which is the expected result.
To sum up, this \ r \ n small editor has tried \ n \ r and seems to be useless. It's just basic knowledge or you don't have to forget it for a long time.
Site Original: Reprinted indicated source http://www.111cn.net