When you write php code, the @ symbol is always added. Do you know what it means? The following small series will share with you the role of the @ symbol. For more information, see
When you write php code, the @ symbol is always added. Do you know what it means? The following small series will share with you the role of the @ symbol. For more information, see
When you are working on a PHP project, you always add the @ symbol before some code lines. Do you know what it means? Next I will share with you the function pre-added at @ in PHP.
I used it today. Just remember it. In fact, it is an error control character. Even if an error occurs, it ignores the error message and continues to execute the following code.
The Code is as follows:
@ $ Page = $ _ GET ['page']? Intval ($ _ GET ['page']): 1;
This is the value of the page keyword obtained from the URL, such as "index. php? Page = 5 ", $ page will get 5.
However, if there is an error, such as "index. php "does not have the page keyword. If $ _ GET ['page'] does not exist, an error is returned. If @ is returned, this small error can be ignored.
For example:
The Code is as follows:
$ Conn = mysqli_conncet ("q", "w", "e", "r ");
In this case, an error message is entered about database connection.
The Code is as follows:
@ $ Conn = mysqli_conncet ("q", "w", "e", "r ");
If @ is added before $ conn, the error message will not be output.
Remember here.
The above is the function of adding at @ in front of PHP. I hope you will like it.