日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

PHP正則匹配中文字母數(shù)字正則表達(dá)式_PHP教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:基于php設(shè)計(jì)模式中工廠模式詳細(xì)介紹
本篇文章是對php設(shè)計(jì)模式中工廠模式進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下

 方法一

 代碼如下
if(preg_match("/^d*$/",   "4312"))
{
echo   "全數(shù)字
";
}

if(preg_match("/^[a-z]*$/i",   "fdsFDfd"))
{
echo   "全字母
";
}

if(preg_match("/^[a-zd]*$/i",   "fd4fd34"))
{
echo   "有數(shù)字有字母
";
}
 

中文漢字

 代碼如下
$username=$_REQUEST['username'];
if(!preg_match("/^[a-z0-9xa1-xff]{3,10}$/",$username))
 {
  echo"34r345";
  exit;
 }
 


上面是比較散的,下面把幾個(gè)總結(jié)到一起來

 代碼如下
$input_tag = $_POST['tag'];
$input_tag = explode(',', $input_tag);
$input_tag = array_unique($input_tag);
$input_tag = array_diff($input_tag, array(null));
$leng      = '';
$true      = '';
$comma     = '';
 
foreach ($input_tag as $v) {
    if (strlen($v) > 18) {
        $leng  .= $comma . $v;
        $comma = ',';
    }
 
    $true .= $comma . $v;
    $comma = ',';
}
 
$true = str_replace(',', '', $true);
if (!preg_match('/^[x80-xff_a-zA-Z0-9]+$/', $true)) {
    echo "<script>alert('不允許特殊符號的!��!');</script>";
    exit;
}
 
if (!empty($leng)) {
    echo "<script>alert('一個(gè)標(biāo)簽只能是6個(gè)漢字以內(nèi)哦�。。�');</script>";
    exit;
}

分享:基于php設(shè)計(jì)模式中單例模式的應(yīng)用分析
本篇文章是對php設(shè)計(jì)模式中單例模式的應(yīng)用進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下

來源:模板無憂//所屬分類:PHP教程/更新時(shí)間:2013-05-16
相關(guān)PHP教程