初始化代码
This commit is contained in:
37
longbingcore/tools/LongbingStr.php
Normal file
37
longbingcore/tools/LongbingStr.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Longbing [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright Chengdu longbing Technology Co., Ltd.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Website http://longbing.org/
|
||||
// +----------------------------------------------------------------------
|
||||
// | Sales manager: +86-13558882532 / +86-13330887474
|
||||
// | Technical support: +86-15680635005
|
||||
// | After-sale service: +86-17361005938
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace longbingcore\tools;
|
||||
|
||||
|
||||
class LongbingStr
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $str
|
||||
* @功能说明:转utf 8
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-01-03 19:23
|
||||
*/
|
||||
|
||||
static public function strToUtf8($str){
|
||||
$encode = mb_detect_encoding($str, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'));
|
||||
if($encode == 'UTF-8'){
|
||||
return $str;
|
||||
}else{
|
||||
return mb_convert_encoding($str, 'UTF-8', $encode);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user