📄 sam.errors.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Error handling</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="sam.examples.html">Examples</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.sam.html">SAM Functions</a></div> <div class="up"><a href="sam.examples.html">Examples</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="sam.errors" class="section"> <h2 class="title">Error handling</h2> <p class="para"> All SAMConnection methods that provide access to messaging operations return <b><tt>FALSE</tt></b> if an error occurred in processing the request. In addition the SAMConnection object has two properties, "errno" and "error", that provide respectively the error number and text description of the last error to occur on the connection. </p> <p class="para"> <div class="example"> <p><b>Example #1 Handling an error from a method that returns no result</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #007700">if (!</span><span style="color: #0000BB">$conn</span><span style="color: #007700">-></span><span style="color: #0000BB">commit</span><span style="color: #007700">()) {<br /> </span><span style="color: #FF8000">// The commit failed!<br /> </span><span style="color: #007700">echo </span><span style="color: #DD0000">"Commit failed ($conn->errno) $conn->error"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> <p class="para"> <div class="example"> <p><b>Example #2 Handling an error from a method that returns a result</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$correlid </span><span style="color: #007700">= </span><span style="color: #0000BB">$conn</span><span style="color: #007700">-></span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #DD0000">'queue://send/test'</span><span style="color: #007700">, </span><span style="color: #0000BB">$msg</span><span style="color: #007700">);<br /><br />if (!</span><span style="color: #0000BB">$correlid</span><span style="color: #007700">) {<br /> </span><span style="color: #FF8000">// The Send failed!<br /> </span><span style="color: #007700">echo </span><span style="color: #DD0000">"Send failed ($conn->errno) $conn->error"</span><span style="color: #007700">;<br />} else {<br /> ...<br />}<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sam.examples.html">Examples</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.sam.html">SAM Functions</a></div> <div class="up"><a href="sam.examples.html">Examples</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 + -