<?php require_once '../service/StudentInfoService.class.php'; require_once '../phpbean/StudentInfo.class.php'; require_once '../service/NationService.class.php'; $nationService = new NationService(); $zkzh = $_GET['zkzh']; $studentInfoService = new StudentInfoService(); $studentInfo = $studentInfoService->GetStudentInfo($zkzh); /*使用 JSON数据格式返回*/ header('Content-type: text/json;charset=utf-8'); echo "{zkzh:\"" . $studentInfo->getZkzh() . "\""; echo ",name:\"" . $studentInfo->getName() . "\""; echo ",sex:\"" . $studentInfo->getSex() . "\""; echo ",kslb:\"" . $studentInfo->getKslb() . "\""; echo ",zzmm:\"" . $studentInfo->getZzmm() . "\""; echo ",nation:\"" . $nationService->GetNation($studentInfo->getNation())->getNationName() . "\""; echo ",byxx:\"" . $studentInfo->getByxx() . "\""; echo ",hkszd:\"" . $studentInfo->getHkszd() . "\""; echo ",address:\"" . $studentInfo->getAddress() . "\""; echo ",telephone:\"" . $studentInfo->getTelephone() . "\""; echo ",zcxx:\"" . $studentInfo->getZcxx() . "\""; echo ",cardNumber:\"" . $studentInfo->getCardNumber() . "\""; echo ",xjh:\"" . $studentInfo->getXjh() . "\""; echo ",gysznj:\"" . $studentInfo->getGysznj() . "\""; echo ",gesznj:\"" . $studentInfo->getGesznj() . "\""; echo ",gssznj:\"" . $studentInfo->getGssznj() . "\""; echo ",memo:\"" . $studentInfo->getMemo() . "\""; echo ",photo:\"" . $studentInfo->getPhoto() . "\""; echo "}";
//$objWriter->save($FileName); //选中保存路径 $outputFileName = iconv('UTF-8', 'gb2312', '学生信息记录.xls'); ob_end_clean(); //清除缓冲区,避免乱码 header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename=' . $outputFileName); header('Cache-Control: max-age=0'); //$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); } else { if ($action == "update") { //说明用户希望执行更新学生信息信息 $array_studentInfo = $_POST["studentInfo"]; $studentInfo = $studentInfoService->GetStudentInfo($array_studentInfo['zkzh']); /*处理图片上传*/ 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']);