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

正则表达式证验老是失败

WBOY
Release: 2016-06-13 12:47:21
Original
1190 people have browsed it

正则表达式验证老是失败

<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>
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template