An example of the PHP @ at Mark's role is to introduce _php tips

Source: Internet
Author: User

Look at the PHP code, there are always some lines in front of the @ symbol, always do not know what it means. For example dede5.7 @ni =imagecreatetruecolor (Ftow, $ftoH);

If you use it today, just remember it. In fact, it is the error control character, that is, even if an error occurred, but also ignore the error message, continue to execute the code below.

@ $page =$_get[' page ']?intval ($_get[' page ']): 1;

The sentence is to get the value of the page keyword from the URL, such as "index.php?page=5", then the $page will take 5.

However, if there is error, such as "index.php" after no page keyword, if you go to fetch $_get[' page ' does not exist will be an error, then have @ can ignore this small mistake.

Another example:

$conn = Mysqli_conncet ("Q", "W", "E", "R");

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

If $conn in front of the @ can not let him output the error message.

@ $conn = Mysqli_conncet ("Q", "W", "E", "R");

Just remember it here.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.