Files
mayi-grade/app/renshi/common.php
T

95 lines
1.8 KiB
PHP

<?php
// 性别
function srcSex($str)
{
if($str == '男')
{
$sex = 1;
}else if($str == '女'){
$sex = 0;
}else{
$sex = 2;
}
return $sex;
}
// 查找学科
function srcSubject($str)
{
// 实例化学科数据模型
$subject = new \app\teach\model\Subject;
// 查询学科id
$subjectId = $subject->where('title',$str)->value('id');
return $subjectId;
}
// 查找职务
function srcZw($str)
{
// 实例化类型数据模型
$category = new \app\system\model\Category;
// 查询学科id
$categoryId = $category->where('pid',107)->where('title',$str)->value('id');
return $categoryId;
}
// 查找学历
function srcXl($str)
{
// 实例化类型数据模型
$category = new \app\system\model\Category;
// 查询学科id
$categoryId = $category->where('pid',105)->where('title',$str)->value('id');
return $categoryId;
}
// 查找职称
function srcZc($str)
{
// 实例化类型数据模型
$category = new \app\system\model\Category;
// 查询学科id
$categoryId = $category->where('pid',106)->where('title',$str)->value('id');
return $categoryId;
}
// 下载文件
function smDownload($url,$newname='')
{
$file = $url;
if(strlen($newname)==0)
{
$newname = filesize($file);
}
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$newname);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
}