定制 gongfangjun/file-manager 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gongfangjun/file-manager

Composer 安装命令:

composer require gongfangjun/file-manager

包简介

A file/dir manager for php

关键字:

README 文档

README

A file/dir manager for php

install

add a line to the "require" section in your composer.json,then run the command: composer update

{
	"require":{
		"gongfangjun/file-manager": "*"
	}
}

how to use it in your project

include './vendor/autoload.php';

use FileManager\FileManager;

//scan sub docs in the dir
$fm = new FileManager('/data/upload/');
foreach ($fm->scan() as $doc) {
	echo $doc->path,"\n";
}

//scan all the docs in the dir 
function scan($path) {
	$fm = new FileManager($path);
	foreach ($fm->scan() as $doc) {
	    if ($doc->isDir) {
	        echo $doc->path,"\n";
	        scan($doc->path);
	    } else {
	        echo $doc->path,"\n";
	        echo "   |- file size : ", $doc->filesize,"\n";
	        echo "   |- last visit time : ", date('Y-m-d H:i:s', $doc->lastVisitTime),"\n";
	        echo "   `- last modify time : ", date('Y-m-d H:i:s', $doc->lastModTime),"\n";
	    }   
	}   
}

scan('/data/upload/');

//delete a file
$fm = new FileManager('/data/upload/js/inc/bootstrap.js');
$fm->del();

//delete a dir
$fm = new FileManager('/data/upload/js/inc/');
$fm->del();

//read a file
$fm = new FileManager('/data/upload/js/index.js');
$fm->getContent();

//write content to a file
$fm = new FileManager('/data/upload/js/index.js');
$fm->write('var userName = "gongfangjun"');

property of FileManager\Component\Document

click here to see the source code

path

isFile

isDir

isReadable

isWritable

lastVisitTime

lastModTime

filesize

apis

scan()

   scan a dir

del()

   del a file or a dir

write()

   write content to a file

getContent()

   get content from a file

createFile()

   create a file

createDir()

   create a dir

统计信息

  • 总下载量: 33
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固