Home >Backend Development >PHP Tutorial > 正则表达式证验老是失败

正则表达式证验老是失败

WBOY
WBOYOriginal
2016-06-13 12:47:211202browse

正则表达式验证老是失败

<body><br />
        <?php<br />
        if(!empty($_POST[sub]))<br />
        {<br />
            <br />
        if(ereg("\d{10}", $_POST[username]))<br />
        <br />
        {echo "验证通过。";}<br />
        else<br />
        {echo "验证失败";}<br />
        }<br />
        ?><br />
        <form action="" method="post"><br />
    用户名<input type="text" name="username"><br><br />
    <input type="submit" name="sub" value="提交"><br />
</form><br />
    </body>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn