\ n is a line change, English is the LINEFEED,ASCII code is 0xA.
\ r is enter, English is carriage return, ASCII code is 0xD.
If you use a mechanical typewriter, you know the difference between carriage return and line change ...
The line is to
In php, the phpfwrite () function is used to write files (which can be safely used for binary files ). Simply put, add new content to a file. This article collects and summarizes several summary about the usage of fwrite () functions in php writing
What are 0x0d and 0x0a
, it's possible that most people know it's a carriage return and a newline character, but that's a carriage return, which is a newline. It is estimated that a lot of people are not clear for a moment---
Perhaps you do not
PHP implements line feed output for carriage return in html source code
Enter a line break in the source code, but do not display characters such as br. We need to use php to turn the characters into characters. Let's take a look at the following.
1. fscanf function and fprintf function 1.1 fscanf functionThe FSCANF function can only be entered as a format from a text file. The FSCANF function is similar to the scanf function, except that the input object is the data for the text file on disk.
Fscanf, fprintf, fgets, fputs, fread, and fwrite functions, fscanffputs1. fscanf function and fprintf function 1.1 fscanf Function
The fscanf function can only be input in the format of a text file. The fscanf function is similar to the scanf
In the source code to enter a newline but do not display such as BR characters we need to escape the characters in PHP to achieve, the following is a look at it.
Knowledge expansion
transition sequence
description
We all know the line break in PHP: \ n, carriage return: \ r, when you need to change lines, it's usually a combination of "\ r \ n". But why does the newline character not work when we write a file using fwrite? Let's look at the following example:
The question about the carriage return when php writes a text file is found today when writing a log file, the written content does not wrap. I checked some information to find some problems .? The related code is as follows :? File_put_contents ($ _
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.