首页 > 其他 > 详细

验证车牌警车能源车

时间:2018-09-10 17:36:32      阅读:159      评论:0      收藏:0      [点我收藏+]
/**

*   判断是否合法车牌号
*  @name isCarLicense
*  @param $license
*  @return bool
*/
function isCarLicense($license){
    if (empty($license)) {
        return false;
    }
    //普通车牌
    $regular = "/[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/u";
    preg_match($regular, $license, $match);
    if (isset($match[0])) {
        return true;
    }
    //小型新能源汽车
    $regular =  "/[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[0-9]{5}[DF]$/u";
    preg_match($regular, $license, $match);
    if (isset($match[0])) {
        return true;
    }
    //大型新能源汽车
    $regular =  "/[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[DF][A-HJ-NP-Z0-9][0-9]{4}$/u";
    preg_match($regular, $license, $match);
    if (isset($match[0])) {
        return true;
    }
    return false;
}

 

验证车牌警车能源车

原文:https://www.cnblogs.com/lhwhqy/p/9621102.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!