descom/file_encoding

PHP编解码文件类

1.0.1 2018-01-30 15:04 UTC

This package is auto-updated.

Last update: 2024-09-07 12:25:30 UTC


README

StyleCI Build Status

PHP转换文件编码

PHP类用于转换文件编码

安装

您可以使用composer安装它

composer require descom/file_encoding

使用方法

encodeFile($file, $encoding_to, $encodings_detected);

这是一个示例

use Descom\File\Encoding;

$codification = new Encoding();

$file = 'file.txt';
$encoding_to = 'UTF-8';
$encodings_detected = 'UTF-8,ISO-8859-1,WINDOWS-1252';

$result = $codification->encodeFile($file, $encoding_to, $encodings_detected);

编码值

允许的编码

https://php.ac.cn/manual/zh/mbstring.supported-encodings.php

默认值

$encoding_to = 'UTF-8';
$encodings_detected = 'UTF-8,ISO-8859-1,WINDOWS-1252';