123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\common\components;
- use Yii;
- use yii\base\Model;
- use Overtrue\Pinyin\Pinyin as py;
- class PinYin extends Model
- {
- private $py;
- public function __construct(){
- $this->py = new py();
- }
-
- public function encode($utf8Data, $sRetFormat='all'){
- if($sRetFormat=='all')
- {
- return $this->py->permalink($utf8Data,'');
- }
- else
- {
- return $this->py->abbr($utf8Data);
- }
- }
- }
|