bobzhai/pinyin

截取中文字符中的拼音

dev-main 2022-12-09 23:44 UTC

This package is auto-updated.

Last update: 2024-09-10 03:16:24 UTC


README

用于与CBSMS交互的PHP库

安装

$ composer require bobzhai/pinyin

或添加到 composer.json

"require": {
    "bobzhai/pinyin": "dev-master"
}

然后运行 composer update.

单次使用

require_once "./vendor/autoload.php";

use Bobzhai\Pinyin\Pinyin;
$input_str,$upper=true,$shift_word=false

/* ---  ucwords -------------------------
* `@input_str` - it's string
* `@upper` - output uppercase true/false 
* `@shift_word` - remove not no character true/false
*/
$code = Pinyin::ucwords('测试',true,false);

echo $code   //  CS

许可证

版权 2022, Bobzhai. 根据MIT许可证授权: https://open-source.org.cn/licenses/mit-license.php