在写注册系统时,如果要检查用户名是否存在,php可以这样写: 复制代码 代码如下: $username=$_REQUEST[‘username’]; $password=$_REQUEST[‘password’]; echo “excute the insertUserInfo”; $con=mysqli_connect(“localhost”,”root”,””,”my_db”); $sql=”SELECT * FROM user WHERE username=’$username'”; ho “this username aready exists”; } else {