Home > Backend Development > PHP Tutorial > PHP programming technology: a brief introduction to the at(@) symbol_PHP tutorial

PHP programming technology: a brief introduction to the at(@) symbol_PHP tutorial

WBOY
Release: 2016-07-21 14:56:14
Original
750 people have browsed it

Bangkejia (www.Bkjia.com) News The following is an introduction to its usage.

  1. function db_connect()//连接数据库
  2. {
  3. @$db =mysql_connect('localhost','root','test');
  4. if(!$db)
  5. throw new Exception('连接数据库失败!请重试!');
  6. mysql_select_db('book');
  7. return $db;
  8. }
复制代码

If the connection to the database is unsuccessful, the preceding "@" can suppress the error display, that is, the error will not be displayed, and then an exception will be thrown and the exception handling defined by you will be displayed. This is added just for browsing If the reader does not see it, the unfriendly page cannot suppress the error, it can only suppress the display of the error! @ Use it where you think there may be errors in future operations. There should be a space after @! It's best to use less, as it seems to increase system overhead.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364281.htmlTechArticleLieHuo.Net News Let’s introduce its usage. function db_connect()//Connect to the database { @$db =mysql_connect('localhost','root','test'); if(!$db) throw new Exception('Connect...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template