Fun.php
645 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace Lib\Imap;
/**
* @author:dc
* @time 2024/10/21 9:47
* Class Fun
* @package Lib\Imap
*/
class Fun {
/**
* 编码
* @param $str
* @param $to
* @param null $from
* @return string
* @author:dc
* @time 2024/10/21 9:43
*/
public static function mb_convert_encoding($str, $to, $from = null){
// 这个好像是阿拉伯编码
if($from == 'iso-8859-8-i'){
$from = 'iso-8859-8';
}
try {
return mb_convert_encoding($str,$to,$from);
}catch (\Throwable $e){}
return mb_convert_encoding($str,$to);
}
}