您现在的位置是:网站首页>软件开发>开发终端>thinkphpthinkphp

TP6操作public下的文件

风口下的猪2021-12-02thinkphp

简介

TP6对自身开放的目录public下的文件操作

1.获取public目录路径

public_path()

2.判断文件是否存在

file_exists($file)
$path=public_path();
$file=$path.'hello.xlsx';
if(file_exists($file)){
     return json(['msg'=>'存在']);
}else{
     return json(['msg'=>'不存在']);
}


3.删除文件

unlink($file)
$path=public_path();
$file=$path.'hello.xlsx';
if(file_exists($file)){
    $res=unlink($file);
}


操作的都是路径




很赞哦! (0)

  • 软件开发
  • 素质要求
  • 计算机基础
  • 架构
  • 安全
  • 性能
  • 运维
  • 尾页
  • 数据库
  • 开发终端
  • 语言基础
  • 项目管理
  • 产品设计
  • 系统
  • 工作规范
  • 计算机网络
  • 前端技术栈
  • 数据结构
  • 计算机组成原理
  • 后端技术栈
  • 性能优化
  • 安全设计
  • 常见模块
  • 计算机操作系统
  • 服务器
  • python
  • MySQL
  • thinkphp
  • PHP
  • Java
  • JavaScript
  • Windows
  • Linux
  • 特效
  • indexedDB
  • vue
  • 淘宝联盟
  • Ionic
  • Angular
  • 微信小程序
  • 支付宝小程序
  • uni-app
  • css/sass/less
  • 支付
  • socket
  • 爬虫
  • web性能优化
  • 消息推送
  • CVM
  • sqlite
  • Redis
  • 前端基础
  • 基础
  • element
  • Nginx
  • yii2
  • /ponder/index.php/index/catelist/catelist/cateid/10.html

    相关阅读 (同一栏目)

    << /

    标签云

    站点信息

    • 文章统计:528篇
    • 移动端访问:扫码进入SQ3R