《XiunoPHP 4.0开发手册》全局变量$errno
XiunoPHP全局变量$errno
错误号,为 0 时,表示正常,非 0 时表示错误。
在某些函数被调用后发生错误,该全局变量会被设置,有点类似于 Linux C 的 errno。
因为 PHP 是同步的(区别于异步)并且线程安全的,所以使用这种方法来返回错误会很方便。
一般配合 errstr 一起使用,函数内通过 xn_error($errno, $errstr) 设置错误。
相比起抛出异常来,这种处理方式会轻量级很多。
【定义】 文件:xiunophp/xiunophp.php 大约 58 行:
$errno = 0;
【用例】
<?php
include './xiunophp/xiunophp.php';
include './xiunophp/xn_send_mail.php';
$r = xn_send_mail(array(), 'username', 'test@gmail.com', '标题', '内容');
if($r === FALSE) {
echo "Errno:".$errno.", Errstr:".$errstr;
}
?>
【相关函数】
xn_error()
稿源:TechTMT.Com综合整理!
分类:文章
标签:
编辑:tmt
版权声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。文章版权归原作者所有,内容不代表本站立场!
免责声明:
阁下应知本站所提供的内容不能做为操作依据。本站作为信息内容发布平台,不对其内容的真实性、完整性、准确性给予任何担保、暗示和承诺,仅供读者参考!
如文中内容影响到您的合法权益(含文章中文字、图片等),请及时联系本站,我们会及时删除处理。
相关文章:
- 《XiunoPHP 4.0开发手册》全局变量$time
- 《XiunoPHP 4.0开发手册》全局变量$ajax
- 《XiunoPHP 4.0开发手册》全局变量$method
- 《XiunoPHP 4.0开发手册》数据库函数db_insert()
- 《XiunoPHP 4.0开发手册》数据库函数db_create()
- 《XiunoPHP 4.0开发手册》数据库函数db_replace()
- 《XiunoPHP 4.0开发手册》数据库函数db_update()
- 《XiunoPHP 4.0开发手册》数据库函数db_maxid()
- 《XiunoPHP 4.0开发手册》数据库函数db_sql_find_one()
- 《XiunoPHP 4.0开发手册》数据库函数db_exec()
- 《XiunoPHP 4.0开发手册》数据库函数db_new()
- 《XiunoPHP 4.0开发手册》缓存函数cache_truncate()
- 《XiunoPHP 4.0开发手册》数组增强array_stripslashes()
- 《XiunoPHP 4.0开发手册》数组增强array_trim()
- 《XiunoPHP 4.0开发手册》数组增强array_diff_value()
- 《XiunoPHP 4.0开发手册》数组增强array_assoc_slice()
- 《XiunoPHP 4.0开发手册》数组增强arrlist_multisort()
- 《XiunoPHP 4.0开发手册》数组增强arrlist_cond_orderby()
- 《XiunoPHP 4.0开发手册》数组增强arrlist_key_values()
- 《XiunoPHP 4.0开发手册》数组增强arrlist_chunk()