function GetStudentInfo($zkzh) { $sql = "select * from t_StudentInfo where zkzh='{$zkzh}'"; $sqlHelper = new SqlHelper(); $arr = $sqlHelper->execute_dql2($sql); $sqlHelper->close_connect(); // 二次封装,$arr=>StudentInfo对象实例 $studentInfo = new StudentInfo(); if (count($arr) > 0) { $studentInfo->setZkzh($arr[0]['zkzh']); $studentInfo->setName($arr[0]['name']); $studentInfo->setSex($arr[0]['sex']); $studentInfo->setKslb($arr[0]['kslb']); $studentInfo->setZzmm($arr[0]['zzmm']); $studentInfo->setNation($arr[0]['nation']); $studentInfo->setByxx($arr[0]['byxx']); $studentInfo->setHkszd($arr[0]['hkszd']); $studentInfo->setAddress($arr[0]['address']); $studentInfo->setTelephone($arr[0]['telephone']); $studentInfo->setZcxx($arr[0]['zcxx']); $studentInfo->setCardNumber($arr[0]['cardNumber']); $studentInfo->setXjh($arr[0]['xjh']); $studentInfo->setGysznj($arr[0]['gysznj']); $studentInfo->setGesznj($arr[0]['gesznj']); $studentInfo->setGssznj($arr[0]['gssznj']); $studentInfo->setMemo($arr[0]['memo']); $studentInfo->setPhoto($arr[0]['photo']); } return $studentInfo; }
$studentInfo->setName($array_studentInfo['name']); $studentInfo->setSex($array_studentInfo['sex']); $studentInfo->setKslb($array_studentInfo['kslb']); $studentInfo->setZzmm($array_studentInfo['zzmm']); $studentInfo->setNation($array_studentInfo['nation']); $studentInfo->setByxx($array_studentInfo['byxx']); $studentInfo->setHkszd($array_studentInfo['hkszd']); $studentInfo->setAddress($array_studentInfo['address']); $studentInfo->setTelephone($array_studentInfo['telephone']); $studentInfo->setZcxx($array_studentInfo['zcxx']); $studentInfo->setCardNumber($array_studentInfo['cardNumber']); $studentInfo->setXjh($array_studentInfo['xjh']); $studentInfo->setGysznj($array_studentInfo['gysznj']); $studentInfo->setGesznj($array_studentInfo['gesznj']); $studentInfo->setGssznj($array_studentInfo['gssznj']); $studentInfo->setMemo($array_studentInfo['memo']); $photo = "/upload/NoImage.jpg"; if ($_FILES['photo']['name'] != '') { /*-- 实例化上传类 --*/ $file = $_FILES['photo']; $upload_path = '../upload'; $allow_type = array('jpg', 'bmp', 'png', 'gif', 'jpeg'); $max_size = 2048000; $upload = new upFiles($file, $upload_path, $max_size, $allow_type); $upload->upload(); $pic = $upload->getSaveFileInfo(); $photo = substr($pic['path'], 2) . "/" . $pic['savename']; } $studentInfo->setPhoto($photo); //完成添加->数据库 $res = $studentInfoService->AddStudentInfo($studentInfo);