实验环境:phpstudy,phpstorm,mysql
试验流程:
1:编写php及html文件,实现数据录入功能。
<?php if (isset($_POST["submit"])){ // 1. 获取对应表单 $username = $_POST["username"]; $password = $_POST["password"]; $repassword = $_POST["repassword"]; $email = $_POST["email"]; $headimg = $_FILES["headimg"]; // a.数据进行验证 几个数据不能为空 if(strlen($username) == 0 || strlen($password) == 0 || strlen($repassword) == 0 || strlen($email) == 0 ){ die("数据不能为空"); } // b. 重复密码需要和密码内容一致 if ($password != $repassword){ die("两次输入密码不一致"); } // c. 用户格式 // d. 邮箱格式 // e. 头像格式 // 1.需要是图片格式 png jpg gif // 2.大小 200K以内 // name 文件名 // tmp_name 临时路径 // size 文件大小 // 后缀名必须是jpg png gif // 通过时间重命