codeinc/human-readable-file-size 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

codeinc/human-readable-file-size

Composer 安装命令:

composer require codeinc/human-readable-file-size

包简介

Human readable file size

README 文档

README

This PHP 7 library, strongly inspired by Jeffrey Sambells' blog post, computes a size in bytes in a human readable form.

Installation

This library is available through Packagist and can be installed using Composer:

composer require codeinc/human-readable-file-size

Usage

Simple usage

<?php
use CodeInc\HumanReadableFileSize\HumanReadableFileSize;

echo HumanReadableFileSize::getHumanSize(filesize('a-file.pdf'));
// outputs 2.88MB 

echo HumanReadableFileSize::getHumanSize(filesize('a-file.pdf'), 1);
// outputs 2.9MB 

echo HumanReadableFileSize::getHumanSize(filesize('a-file.pdf'), 0);
// outputs 3MB

Full configuration usage

<?php
use CodeInc\HumanReadableFileSize\HumanReadableFileSize;

$readableSize = new HumanReadableFileSize();
$readableSize->useNumberFormatter('fr-FR');
$readableSize->setSpaceBeforeUnit();
$readableSize->setByteSymbol('o');
echo $readableSize->compute(filesize('a-file.pdf'), 1);
// outputs 2,9 Mo 

License

This library is published under the MIT license (see the LICENSE file).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固