xn_error()
xn_error($no, $str, $return = FALSE)
【功能】
对全局变量 $errno, $errstr 进行设置,并且默认返回 FALSE。
【原型】
function xn_error($no, $str, $return = FALSE) {
global $errno, $errstr;
$errno = $no;
$errstr = $str;
return $return;
}
【参数】
$no:错误码
$str:错误字符串
$return:返回值
【用例】
<?php
include "./xiunophp/xiunophp.php";
function check_email($email) {
if(empty($email)) {
return xn_error(-1, "Email 为空");
}
}
my_func("") OR echo $errstr;
?>