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;
 }
Ejemplo n.º 2
0
//创建了StudentInfoService实例
$studentInfoService = new StudentInfoService();
//根据action参数决定用户要执行什么样的操作
if (!empty($_REQUEST['action'])) {
    //接收action值
    $action = $_REQUEST['action'];
    if ($action == "add") {
        //说明用户希望执行添加学生信息信息
        $studentInfo = new StudentInfo();
        $array_studentInfo = $_POST["studentInfo"];
        /*处理图片上传*/
        require_once "../util/upload.class.php";
        require_once "../util/util.php";
        $studentInfo->setZkzh($array_studentInfo['zkzh']);
        $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";