>
//函数名:CheckTelephone($C_telephone) //作用:判断是否为合法电话号码 //参数:$C_telephone(待检测的电话号码) //返回值:布尔值 //备注:无 //----------------------------------------------------------------------------------- ------- functionCheckTelephone($C_telephone) { if(!ereg("^[+]?[0-9]+([xX-][0-9]+)*$",$C_telephone))returnfalse; returntrue; } //----------------------------------------------------------------------------------- ------- //----------------------------------------------------------------------------------- ------- //函数名:CheckValueBetween($N_var,$N_val1,$N_val2) //作用:判断是否是某一范围内的合法值 //参数:$N_var待检测的值 //$N_var1待检测值的上限 //$N_var2待检测值的下限 //返回值:布尔值 //备注:无 //----------------------------------------------------------------------------------- ------- functionCheckValueBetween($N_var,$N_val1,$N_val2) { if($N_var<$N_var1││$N_var>$N_var2) { returnfalse; } returntrue; } //----------------------------------------------------------------------------------- ------- //----------------------------------------------------------------------------------- ------- //函数名:CheckPost($C_post) //作用:判断是否为合法邮编(固定长度) //参数:$C_post(待check的邮政编码) //返回值:布尔值 //备注:无 //----------------------------------------------------------------------------------- ------- functionCheckPost($C_post) { $C_post=trim($C_post); if(strlen($C_post)==6) { if(!ereg("^[+]?[_0-9]*$",$C_post)) { returntrue;; }else { returnfalse; } }else { returnfalse;; } } //----------------------------------------------------------------------------------- ------- |