1. Home
  2. Docs
  3. 程序工具
  4. 中文转拼音

中文转拼音

语言版本库

api接口

Golang-pinyin

Node.js-JavaScript

Python-pinyin

rust-pinyin

PHP-demo

thinkphp3.2.3 基于composer安装 ### 使用过程

tip: overtrue/pinyin: ~3.0 主要添加了这段“`

```
{
    name: topthink/thinkphp,
    description: the ThinkPHP Framework,
    type: framework,
    keywords: [framework,thinkphp,ORM],
    homepage: http://thinkphp.cn/,
    license: Apache2,
    authors: [
        {
            name: liu21st,
            email: liu21st@gmail.com
        }
    ],
    require: {
        php: >=5.3.0,
        filp/whoops: ^2.1,
        overtrue/pinyin: ~3.0
    },
    minimum-stability: dev
}
```
```

执行命令: composer update thinkphp控制器中使用 ```
<pre class="pure-highlightjs">```
<?php
namespace Admin\Controller;
require $_SERVER['DOCUMENT_ROOT'].__ROOT__.'/vendor/autoload.php';
class xxx{
$pinyin = new \Overtrue\Pinyin\Pinyin;//中文转拼音
$pinyin->convert('我是中文'); //取拼音 
$pinyin->abbr('我是中文'); //取首字母
}

```
```

 [中文转拼音](https://github.com/overtrue/pinyin) 、

[ thinkphp3.2.3使用composer实例](http://www.cnblogs.com/dee0912/p/5743942.html)
Was this article helpful to you? Yes No

How can we help?