遇到的问题:在使用Curl 远程请求的时候 参数里包涵中文直接请求报错 。去掉中文换成英文或数字请求没事。
解决方法: 将中文参数挨个走一遍这个公共方法即可。
public function str_to_utf8 ($str = '') {
$current_encode = mb_detect_encoding($str, array("ASCII","GB2312","GBK",'BIG5','UTF-8'));
$encoded_str = mb_convert_encoding($str, 'UTF-8', $current_encode);
return $encoded_str;
}