验证车牌警车能源车

Posted lhwhqy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了验证车牌警车能源车相关的知识,希望对你有一定的参考价值。

/**

*   判断是否合法车牌号
*  @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;
}

 

以上是关于验证车牌警车能源车的主要内容,如果未能解决你的问题,请参考以下文章