Get the App
SLTechnology News&Howtos  ›  Development  › 

An introduction to the function of adding at symbol @ before PHP

Shulou Source: shulou.com Published: 2022-06-03 17:32:53 11月13日 Update

PHP before adding the at symbol @ function of the relevant introduction, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

The copy code is as follows:

@ $page=$_GET ['page']? intval ($_ GET [' page']): 1

This is to get the value of the page keyword from URL. For example, "index.php?page=5", $page will get 5.

But if there is an error, for example, there is no page keyword after "index.php", if the $_ GET ['page'] does not exist, an error will be reported, and @ can ignore this small error.

Another example is:

The copy code is as follows:

$conn = mysqli_conncet ("Q", "w", "e", "r")

This will enter an error message about connecting to the database.

The copy code is as follows:

@ $conn = mysqli_conncet ("Q", "w", "e", "r")

If you precede $conn with @, you can prevent him from outputting error messages.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Code key keyword help function symbol clarity information content for this glitch data database article novice aspect more knowledge industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker vpn Shulou Information NVidia Redmi