yurunsoft / chineseutil Goto Github PK
View Code? Open in Web Editor NEWPHP 中文工具包,支持汉字转拼音、拼音分词、简繁互转、数字、金额大写;QQ群:17916227
Home Page: https://gitee.com/yurunsoft/ChineseUtil
License: MIT License
PHP 中文工具包,支持汉字转拼音、拼音分词、简繁互转、数字、金额大写;QQ群:17916227
Home Page: https://gitee.com/yurunsoft/ChineseUtil
License: MIT License
30000.00 toChiness 叁万零圆
version: 2.0.4
$string = 'xixijinpingsb';
$resp = Chinese::splitPinyin($string);
结果是
array(1) {
[0]=>
string(25) "x i x i j i n p i n g s b"
}
我都不知道我这么写对不对
\Yurun\Util\Chinese::toPinyin($requestData['name'], \Yurun\Util\Chinese\Pinyin::CONVERT_MODE_PINYIN_FIRST)['pinyinFirst']??''
还要输出下就效率慢了
大哥你没测试吗?
如题,在PHP7.2.12中报告致命的错误。
文件:Memory.php
行数:84
位置:$result['pinyin'][$j][] = $pinyin;
这是因为同一变量前后赋值的类型不一致导致的致命错误,emmm……
位置 93 行
/www/blog/vendor/yurunsoft/chinese-util/src/Chinese/FFIDriver.php
}
else
{
$library = "libchinese_util-php{$phpVersion}.so";
}
}
$library = $clibPath . '/' . $library;
}
$this->ffi = $ffi = PHPFFI::cdef(file_get_contents($clibPath . '/include.h'), $library);
$ffi->init_chinese_util();
$dataPath = \dirname(DIR, 2) . '/data';
if (!$characterDataPath)
{
$characterDataPath = $dataPath . '/charsData.json';
}
if (!$pinyinDataPath)
{
$pinyinDataPath = $dataPath . '/pinyinData.json';
}
这里 -> init_chinese_dict($characterDataPath, $pinyinDataPath);
}
报错信息
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to undefined function Yurun\Util\Chinese\init_chinese_dict()
环境
docker
php-fpm 7.4.1 openresty 1.17
这个问题刷新几次页面就好了,时而好时而坏
src/Chinese/Driver/Pinyin/Memory.php line 229:
'pinyin' => [$word],
'pinyinSound' => [$word],
'pinyinSound' => [$word], //Redundant code
'pinyinSoundNumber' => [$word],
yurunsoft\chinese-util\src\Chinese\Driver\Money\Memory.php 行237
$unitIndex = ($length - 1) / 4 >> 0;
环境 php 8.2.5,高版本对数据类型严格检查,数字为222三位时,错误提示 Implicit conversion from float 0.5 to int loses precision
建议修复兼容
` public function toChinese($number, $options = [])
{
if (!static::verifyNumber($number))
{
throw new \InvalidArgumentException(sprintf('%s is not a valied number', $number));
}
list($integer, $decimal) = explode('.', $number . '.');
if ($integer < 0)
{
$pom = static::$numberMap['-'];
$integer = abs($integer);
}
else
{
$pom = '';
}
if ($integer > 0)
{
return $pom . static::parseInteger($integer, $options) . static::parseDecimal($decimal, $options);
}
elseif (!$decimal)
{
return static::$numberMap[0] . static::$moneyUnitMap[0][0];
}
else
{
return $pom . static::parseDecimal($decimal, $options);
}
}`
判断正负的时候应该使用number来判断。现在 -0.09这种都转为零玖分,应该是负零玖分
提示 :
PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'libchinese_util-swoole4.5.so' in Unknown on line 0
已安装环境: php7.4 swoole4.5
如何把 “” 轉換成 直角引号(「」或『』 ) ?
目前好像不能。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.