本文整理汇总了PHP中get_save_path函数的典型用法代码示例。如果您正苦于以下问题:PHP get_save_path函数的具体用法?PHP get_save_path怎么用?PHP get_save_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_save_path函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: import
public function import()
{
$save_path = get_save_path();
$opmode = $_POST["opmode"];
if ($opmode == "import") {
import("@.ORG.Util.UploadFile");
$upload = new UploadFile();
$upload->savePath = $save_path;
$upload->allowExts = array('xlsx');
$upload->saveRule = uniqid;
$upload->autoSub = false;
if (!$upload->upload()) {
$this->error($upload->getErrorMsg());
} else {
//取得成功上传的文件信息
$uploadList = $upload->getUploadFileInfo();
Vendor('Excel.PHPExcel');
//导入thinkphp第三方类库
$inputFileName = $save_path . $uploadList[0]["savename"];
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
$model = M("Customer");
for ($i = 2; $i <= count($sheetData); $i++) {
$data = array();
$data['name'] = $sheetData[$i]["A"];
$data['short'] = $sheetData[$i]["B"];
$data['letter'] = get_letter($sheetData[$i]["A"]);
$data['biz_license'] = $sheetData[$i]["C"];
$data['payment'] = $sheetData[$i]["D"];
$data['address'] = $sheetData[$i]["E"];
$data['salesman'] = $sheetData[$i]["F"];
$data['contact'] = $sheetData[$i]["G"];
$data['email'] = $sheetData[$i]["H"];
$data['office_tel'] = $sheetData[$i]["I"];
$data['mobile_tel'] = $sheetData[$i]["J"];
$data['fax'] = $sheetData[$i]["K"];
$data['im'] = $sheetData[$i]["L"];
$data['remark'] = $sheetData[$i]["M"];
$data['is_del'] = 0;
$model->add($data);
}
//dump($sheetData);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/" . $inputFileName)) {
unlink($_SERVER["DOCUMENT_ROOT"] . "/" . $inputFileName);
}
$this->assign('jumpUrl', get_return_url());
$this->success('导入成功!');
}
} else {
$this->display();
}
}
开发者ID:2ger,项目名称:trunk,代码行数:52,代码来源:CustomerAction.class.php
示例2: player
function player()
{
$user_id = get_user_id();
$this->assign("user_id", $user_id);
$file_id = $_GET['attach_id'];
$file_id = f_decode($file_id);
$add_file = explode(";", $add_file);
$add_file = $add_file[0];
$where['id'] = $file_id;
$video_path = M("File")->where($where)->getField("savename");
$video_ext = M("File")->where($where)->getField("extension");
$this->assign('video_file', get_save_path() . $video_path);
$this->assign('video_ext', $video_ext);
$this->display();
}
开发者ID:hongweipeng,项目名称:oa,代码行数:15,代码来源:FileAction.class.php
示例3: _upload
/** 上传限制 */
protected function _upload()
{
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if (!empty($_FILES)) {
import("@.ORG.Util.UploadFile");
$upload = new UploadFile();
$upload->subFolder = strtolower(MODULE_NAME);
$upload->savePath = get_save_path();
$upload->saveRule = "uniqid";
$upload->autoSub = true;
$upload->subType = "date";
/** @var allowExts上传格式设置 */
$allowExts_arr = array('jpg', 'jpeg', 'png');
$upload->allowExts = array_filter($allowExts_arr, 'upload_filter');
if (!$upload->upload()) {
$data['error'] = 1;
$data['message'] = $upload->getErrorMsg();
$data['status'] = 0;
exit(json_encode($data));
//exit($upload -> getErrorMsg());
} else {
//取得成功上传的文件信息
$upload_list = $upload->getUploadFileInfo();
$sid = get_sid();
$file_info = $upload_list[0];
// var_dump($file_info);
$model = M("File");
$model->create($upload_list[0]);
$model->create_time = time();
$model->user_id = get_user_id();
$model->sid = $sid;
$model->module = MODULE_NAME;
$file_id = $model->add();
$file_info['sid'] = $sid;
$file_info['error'] = 0;
$file_info['url'] = __ROOT__ . "/" . $file_info['savepath'] . $file_info['savename'];
$file_info['status'] = 1;
//header("Content-Type:text/html; charset=utf-8");
exit(json_encode($file_info));
//$this->ajaxReturn(json_encode($file_info),'上传成功',1,$file_info['url']);
//$this->success ('上传成功!');
}
}
}
开发者ID:TipTimesPHP,项目名称:tyj_oa,代码行数:49,代码来源:DutyRecordAction.class.php
示例4: import
public function import()
{
$save_path = get_save_path();
$opmode = $_POST["opmode"];
if ($opmode == "import") {
import("@.ORG.Util.UploadFile");
$upload = new UploadFile();
$upload->savePath = $save_path;
$upload->allowExts = array('xlsx', 'xls');
$upload->saveRule = uniqid;
$upload->autoSub = false;
if (!$upload->upload()) {
$this->error($upload->getErrorMsg());
} else {
//取得成功上传的文件信息
$uploadList = $upload->getUploadFileInfo();
Vendor('Excel.PHPExcel');
//导入thinkphp第三方类库
$inputFileName = $save_path . $uploadList[0]["savename"];
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
// dump(count($sheetData));
// exit;
$model = M(MODULE_NAME);
//dump($sheetData);
for ($i = $this->first_row; $i <= count($sheetData); $i++) {
$data = array();
$data['emp_no'] = $sheetData[$i]["A"];
// $data['B']=PHPExcel_Shared_Date::ExcelToPHP($sheetData[$i]["B"]);
$data['B'] = $sheetData[$i]["B"];
for ($k = 67; $k <= 67 + $this->field_count; $k++) {
$data[chr($k)] = $sheetData[$i][chr($k)];
}
$model->add($data);
}
//dump($sheetData);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/" . $inputFileName)) {
unlink($_SERVER["DOCUMENT_ROOT"] . "/" . $inputFileName);
}
$this->assign('jumpUrl', get_return_url());
$this->success('导入成功!');
}
} else {
$this->display();
}
}
开发者ID:TipTimesPHP,项目名称:tyj_oa,代码行数:46,代码来源:UdfAction.class.php
示例5: _destory_file
protected function _destory_file($file_list)
{
if (isset($file_list)) {
if (is_array($file_list)) {
$where["sid"] = array("in", $file_list);
} else {
$where["sid"] = array('in', array_filter(explode(',', $file_list)));
}
}
$model = M("File");
$where['module'] = MODULE_NAME;
$admin = $this->config['auth']['admin'];
if ($admin) {
$where['user_id'] = array('eq', get_user_id());
}
$list = $model->where($where)->select();
$save_path = get_save_path();
foreach ($list as $file) {
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/" . $save_path . $file['savename'])) {
unlink($_SERVER["DOCUMENT_ROOT"] . "/" . $save_path . $file['savename']);
}
}
$result = $model->where($where)->delete();
if ($result !== false) {
return true;
} else {
return false;
}
}
开发者ID:TipTimesPHP,项目名称:tyj_oa_cp,代码行数:29,代码来源:CommonAction.class.php
示例6: _receive_file
private function _receive_file($str, &$model)
{
if (!empty($str)) {
$ar = array_filter(explode(",", $str));
foreach ($ar as $key => $value) {
$ar2 = explode("_", $value);
$cid = $ar2[0];
if (true) {
//if(strlen($cid)>10){
$inline = $ar2[1];
$file_name = $ar2[2];
$File = M("File");
$File->name = $file_name;
$File->user_id = $model->user_id;
$File->size = filesize($this->tmpPath . urlencode($value));
$File->extension = getExt($value);
$File->create_time = time();
$sid = get_sid();
$File->sid = $sid;
$File->module = MODULE_NAME;
$dir = 'mail/' . get_emp_no() . "/" . date("Ym");
$File->savename = $dir . '/' . uniqid() . '.' . $File->extension;
$save_name = $File->savename;
if (!is_dir(get_save_path() . $dir)) {
mkdir(get_save_path() . $dir, 0777, true);
chmod(get_save_path() . $dir, 0777);
}
if (!is_dir($this->tmpPath . $dir)) {
mkdir($this->tmpPath . $dir, 0777, true);
chmod($this->tmpPath . $dir, 0777);
}
if (rename($this->tmpPath . urlencode($value), get_save_path() . $save_name)) {
$file_id = $File->add();
if ($inline == "INLINE") {
$model->content = str_replace("cid:" . $cid, "/" . get_save_path() . $save_name, $model->content);
} else {
$add_file = $add_file . $sid . ';';
}
}
}
}
return $add_file;
}
}
开发者ID:zqstudio2015,项目名称:smeoa,代码行数:44,代码来源:MailAction.class.php
示例7: resize_img
function resize_img()
{
if (!($image = $_POST["img"])) {
$result['result_code'] = 101;
$result['result_des'] = "图片不存在";
} else {
$real_img = $_SERVER['DOCUMENT_ROOT'] . $image;
$info = get_img_info($real_img);
if (!$info) {
$result['result_code'] = 102;
$result['result_des'] = $image;
} else {
$max_width = 440;
if ($info['type'] == 'jpg' || $info['type'] == 'jpeg') {
$im = imagecreatefromjpeg($real_img);
}
if ($info['type'] == 'gif') {
$im = imagecreatefromgif($real_img);
}
if ($info['type'] == 'png') {
$im = imagecreatefrompng($real_img);
}
if ($info['width'] <= $max_width) {
$rate = 1;
} else {
$rate = $info['width'] / $max_width;
if ($info['width'] > $info['height']) {
$max_height = intval($info['height'] / ($info['width'] / $max_width));
} else {
$max_width = intval($info['width'] / ($info['height'] / $max_height));
}
}
$x = $_POST["x"];
$y = $_POST["y"];
$w = $_POST["w"];
$h = $_POST["h"];
$width = $srcWidth = $info['width'];
$height = $srcHeight = $info['height'];
$type = empty($type) ? $info['type'] : $type;
$type = strtolower($type);
unset($info);
//创建缩略图
if ($type != 'gif' && function_exists('imagecreatetruecolor')) {
$thumbImg = imagecreatetruecolor($width, $height);
} else {
$thumbImg = imagecreate($width, $height);
}
// 复制图片
if (function_exists("imagecopyresampled")) {
imagecopyresampled($thumbImg, $im, 0, 0, 0, 0, $width, $height, $srcWidth, $srcHeight);
} else {
imagecopyresized($thumbImg, $im, 0, 0, 0, 0, $width, $height, $srcWidth, $srcHeight);
}
if ('gif' == $type || 'png' == $type) {
$background_color = imagecolorallocate($thumbImg, 0, 255, 0);
imagecolortransparent($thumbImg, $background_color);
}
// 对jpeg图形设置隔行扫描
if ('jpg' == $type || 'jpeg' == $type) {
imageinterlace($thumbImg, 1);
}
if (!is_dir(get_save_path() . "emp_pic/")) {
mkdir(get_save_path() . "emp_pic/", 0777, true);
chmod(get_save_path() . "emp_pic/", 0777);
}
// 生成图片
$imageFun = 'image' . ($type == 'jpg' ? 'jpeg' : $type);
$id = $_REQUEST['id'];
$thumbname = get_save_path() . "emp_pic/" . $id . "." . $type;
$imageFun($thumbImg, $thumbname, 100);
$thumbImg_120 = imagecreatetruecolor(120, 120);
imagecopyresampled($thumbImg_120, $thumbImg, 0, 0, intval($x * $rate), intval($y * $rate), intval(120 * 1), intval(120 * 1), intval($w * $rate), intval($h * $rate));
$imageFun($thumbImg_120, $thumbname, 100);
imagedestroy($thumbImg);
imagedestroy($im);
$result['result_code'] = 1;
$result['result_des'] = str_replace(get_save_path(), "", $thumbname);
}
}
echo json_encode($result);
}
开发者ID:hongweipeng,项目名称:oa,代码行数:81,代码来源:PopupAction.class.php
示例8: _down
protected function _down()
{
$attach_id = $_REQUEST["attach_id"];
$file_id = f_decode($attach_id);
$File = M("File")->find($file_id);
$filepath = get_save_path() . $File['savename'];
$filePath = realpath($filepath);
$fp = fopen($filePath, 'rb');
$ua = $_SERVER["HTTP_USER_AGENT"];
if (!preg_match("/MSIE/", $ua)) {
header("Content-Length: " . filesize($filePath));
Header("Content-type: application/octet-stream");
header("Content-Length: " . filesize($filePath));
header("Accept-Ranges: bytes");
header("Accept-Length: " . filesize($filePath));
}
header("Content-Disposition:attachment;filename =" . str_ireplace('+', '%20', URLEncode($File['name'])));
header('Cache-Control:must-revalidate, post-check=0,pre-check=0');
header('Expires: 0');
header('Pragma: public');
//echo $query;
fpassthru($fp);
exit;
}
开发者ID:zqstudio2015,项目名称:smeoa,代码行数:24,代码来源:CommonAction.class.php
示例9: get_emp_pic
function get_emp_pic($id)
{
$data = M("User")->where("id={$id}")->getField("pic");
if (empty($data)) {
$data = get_save_path() . "emp_pic/no_avatar.jpg";
}
return $data;
}
开发者ID:hongweipeng,项目名称:oa,代码行数:8,代码来源:common.php
示例10: sync_send_to
//.........这里部分代码省略.........
foreach ($mail_list as $val) {
// dump($val);
// exit;
if (PHPMailer::validateAddress($item)) {
$mail->AddAddress($item, $val["emp_name"]);
}
// 收件人
}
} else {
$arr_tmp = explode('|', $item);
if (PHPMailer::validateAddress($item)) {
$mail->AddAddress($item, $arr_tmp[0]);
}
// 收件人
}
}
$arr_cc = array_filter(explode(';', $cc));
foreach ($arr_to as $item) {
if (strpos($item, "dept@group") !== false) {
$arr_tmp = array_filter(explode('|', $item));
$dept_id = str_replace("dept_", '', $arr_tmp[2]);
$mail_list = $this->get_mail_list_by_dept_id($dept_id);
foreach ($mail_list as $val) {
if (PHPMailer::validateAddress($val["email"])) {
$mail->AddAddress($val["email"], $val["emp_name"]);
}
// 收件人
}
} else {
$arr_tmp = explode('|', $item);
if (PHPMailer::validateAddress($arr_tmp[1])) {
$mail->AddAddress($arr_tmp[1], $arr_tmp[0]);
}
// 收件人
}
}
$arr_bcc = array_filter(explode(';', $bcc));
foreach ($arr_bcc as $item) {
if (strpos($item, "dept@group") !== false) {
$arr_tmp = array_filter(explode('|', $item));
$dept_id = str_replace("dept_", '', $arr_tmp[2]);
$mail_list = $this->get_mail_list_by_dept_id($dept_id);
foreach ($mail_list as $val) {
if (PHPMailer::validateAddress($val["email"])) {
$mail->AddAddress($val["email"], $val["emp_name"]);
}
// 收件人
}
} else {
$tmp = explode('|', $item);
var_dump(PHPMailer::validateAddress($arr_tmp[1]));
if (PHPMailer::validateAddress($tmp[1])) {
$mail->AddAddress($tmp[1], $tmp[0]);
}
// 收件人
}
}
$mail->Subject = "=?UTF-8?B?" . base64_encode($title) . "?=";
//嵌入式图片处理
if (preg_match('/\\/Data\\/files\\/\\d{6}\\/.{14}(jpg|gif|png)/', $body, $images)) {
$i = 1;
foreach ($images as $image) {
if (strlen($image) > 20) {
$cid = 'img' . $i++;
$name = $mail->AddEmbeddedImage(substr($image, 1), $cid);
$body = str_replace($image, "cid:{$cid}", $body);
}
}
}
$mail->MsgHTML($body);
$add_file = $_REQUEST['add_file'];
if (!empty($add_file)) {
$files = $this->_real_file($add_file);
foreach ($files as $file) {
$mail->AddAttachment(get_save_path() . $file['savename'], $file['name']);
}
}
//同步内部邮箱
$flag = $this->_send();
if (!$flag) {
$this->error("内部错误");
}
if ($mail->Send()) {
cookie('current_node', 105);
return true;
// $this->success("发送成功", U('mail/receiving'));
} else {
$this->error($mail->ErrorInfo);
}
} catch (phpmailerException $e) {
echo $e->errorMessage();
// $exception = $e -> errorMessage();
// $this->error("发送失败!$exception");
//Pretty error messages from PHPMailer
} catch (Exception $e) {
// echo "aaaaaa";
echo $e->getMessage();
//Boring error messages from anything else!
}
}
开发者ID:TipTimesPHP,项目名称:tyj_oa,代码行数:101,代码来源:MobilePhoneEmailAction.class.php
注:本文中的get_save_path函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论