• tp5文件上传


          //tp5上传文件先 use thinkFile;
        //上传文件处理 $file = request()->file('file');    // 获取表单提交过来的文件 $error = $_FILES['file']['error'];   // 如果$_FILES['file']['error']>0,表示文件上传失败
    if($error){ echo "<script>alert('文件上传失败!');location.href='".$_SERVER["HTTP_REFERER"]."';</script>";  // 返回上一页并刷新 } //上传的时候的原文件名 $filename = $file -> getInfo()['name']; $dir = config('upload_path');      // 自定义文件上传路径 if (!is_dir($dir)) { mkdir($dir,0777,true); } $info = $file->move($dir);    // 将文件上传指定目录 //获取文件的全路径 $data['attrurl'] = str_replace('\', '/', $info->getPathname());  //GetPathName返回文件路径(盘符+路径+文件名)
  • 相关阅读:
    鼠标滑过,解决ul下 li下a的背景与父级Li不同宽的问题
    php函数
    常用函数之数组函数
    php流程控制
    php运算符
    php常量
    php变量的数据类型
    PHP是什么
    css3新增属性
    html5的常用标签
  • 原文地址:https://www.cnblogs.com/chrdai/p/6090419.html
Copyright © 2020-2023  润新知