cnpait / detect_encoding
西里尔文文本编码检测类
dev-master
2020-01-10 14:35 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-09-11 00:15:30 UTC
README
检测 utf-8, windows-1251, koi8-r, iso8859-5 西里尔文编码
使用 Composer 安装
在你的项目 composer.json
文件中声明 detect_encoding 为依赖
{ "require": { "ivanmtw/detect_encoding": "dev-master" } }
使用示例
<?php use DetectCyrillic\Encoding; $text = 'Привет, как дела?'; //require_once 'detect_encoding/classes/DetectCyrillic/Encoding.php'; $Detector = new Encoding(); $encoding = $Detector->detectMaxRelevant($text); ?>
需求
PHP 5.3 and up.
用于检测文本编码的类。使用统计方法,详见原始文章
代码是基于 https://github.com/m00t/detect_encoding/ 的一个可用的包装器