Fun.php 645 字节
<?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);
    }


}