yupmin/php-chardet

1.0.1 2015-10-27 13:00 UTC

This package is auto-updated.

Last update: 2024-08-29 03:18:04 UTC


README

介绍

PHP 对 chardet 命令的包装

目录

安装

1 - 安装 chardet

您应该安装 chardet

使用 pip

sudo pip install chardet
sudo ln -s /usr/local/bin/chardetect /usr/local/bin/chardet

在 Ubuntu Linux 上

sudo apt-get install python-chardet

2 - 在您的 PHP 项目中集成

要使用此库,请通过 Composer 安装,运行

composer require yupmin/php-chardet

如何使用

检索 chardet 容器

<?php
//...
use Yupmin\PHPChardet\Chardet;
//...
$chardet = new Chardet();
$chardetContainer = $chardet->analyze('test.txt');

$filePath = $chardetContainer->getFilePath();
$charset = $chardetContainer->getCharset();
$confidence = $chardetContainer->getConfidence();
//...

许可证

更多信息请参阅 LICENSE

参考