验证手机号码格式修改

master
liuweiwen 5 years ago
parent 8b33a52cd0
commit 51d2d91671

@ -854,3 +854,11 @@ function convertAmountToCn($num) {
return $daxie . '整';
}
/**
* @param $phone
* @return false|int
*/
function checkPhone($phone) {
return preg_match("/^1[3456789]\d{9}$/",$phone);
}

@ -726,7 +726,7 @@ class ToolController extends ThinkController {
$this->error('公司名称已存在');
}
if(!preg_match("/^1[358][0-9]{9}$/u",I('link_phone'))) {
if(!checkPhone(I('link_phone'))) {
$this->error('联系电话格式不正确');
}
$res2 = $model->where(['link_phone' => I('link_phone')])->getField('id');
@ -798,7 +798,7 @@ class ToolController extends ThinkController {
$this->error('公司名称已存在');
}
if(!preg_match("/^1[358][0-9]{9}$/u",I('link_phone'))) {
if(!checkPhone(I('link_phone'))) {
$this->error('联系电话格式不正确');
}
$res2 = $model->where([

Loading…
Cancel
Save