⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 language.operators.errorcontrol.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Error Control Operators</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.operators.comparison.html">Comparison Operators</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.operators.execution.html">Execution Operators</a></div> <div class="up"><a href="language.operators.html">Operators</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="language.operators.errorcontrol" class="sect1">   <h2 class="title">Error Control Operators</h2>   <p class="simpara">    PHP supports one error control operator: the at sign (@). When    prepended to an expression in PHP, any error messages that might    be generated by that expression will be ignored.   </p>   <p class="simpara">    If the <a href="errorfunc.configuration.html#ini.track-errors" class="link"><span class="option">track_errors</span></a>    feature is enabled, any error message generated by the expression    will be saved in the variable    <var class="varname"><a href="reserved.variables.phperrormsg.html" class="classname">$php_errormsg</a></var>.    This variable will be overwritten on each error, so check early if you    want to use it.   </p>   <p class="para">    <div class="informalexample">     <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;Intentional&nbsp;file&nbsp;error&nbsp;*/<br /></span><span style="color: #0000BB">$my_file&nbsp;</span><span style="color: #007700">=&nbsp;@</span><span style="color: #0000BB">file&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">'non_existent_file'</span><span style="color: #007700">)&nbsp;or<br />&nbsp;&nbsp;&nbsp;&nbsp;die&nbsp;(</span><span style="color: #DD0000">"Failed&nbsp;opening&nbsp;file:&nbsp;error&nbsp;was&nbsp;'$php_errormsg'"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;this&nbsp;works&nbsp;for&nbsp;any&nbsp;expression,&nbsp;not&nbsp;just&nbsp;functions:<br /></span><span style="color: #0000BB">$value&nbsp;</span><span style="color: #007700">=&nbsp;@</span><span style="color: #0000BB">$cache</span><span style="color: #007700">[</span><span style="color: #0000BB">$key</span><span style="color: #007700">];&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;will&nbsp;not&nbsp;issue&nbsp;a&nbsp;notice&nbsp;if&nbsp;the&nbsp;index&nbsp;$key&nbsp;doesn't&nbsp;exist.<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>     </div>    </div>   </p>   <blockquote><p><b class="note">Note</b>:     <span class="simpara">     The @-operator works only on     <a href="language.expressions.html" class="link">expressions</a>. A simple rule     of thumb is: if you can take the value of something, you can prepend     the @ operator to it. For instance, you can prepend it to variables,     function and <b>include()</b> calls, constants, and     so forth. You cannot prepend it to function or class definitions,     or conditional structures such as <i>if</i> and     <i>foreach</i>, and so forth.    </span>   </p></blockquote>   <p class="simpara">    See also <a href="function.error-reporting.html" class="function">error_reporting()</a> and the manual section for    <a href="ref.errorfunc.html" class="link">Error Handling and Logging functions</a>.   </p>   <div class="warning"><b class="warning">Warning</b>    <p class="para">     Currently the &quot;@&quot; error-control operator prefix will even disable     error reporting for critical errors that will terminate script     execution. Among other things, this means that if you use &quot;@&quot; to     suppress errors from a certain function and either it isn&#039;t     available or has been mistyped, the script will die right there     with no indication as to why.    </p>   </div>  </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.operators.comparison.html">Comparison Operators</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.operators.execution.html">Execution Operators</a></div> <div class="up"><a href="language.operators.html">Operators</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -