function escape($sStr, $sInCharset='GBK', $sOutCharset='UTF-8'){
return str_replace('\U', '%u', strtoupper(trim(json_encode(convert_encoding($sInCharset, $sOutCharset, '阿里巴巴')), '"')));
}
其实就一行代码很简单,都是用的原生的函数。
function escape($sStr, $sInCharset='GBK', $sOutCharset='UTF-8'){
return str_replace('\U', '%u', strtoupper(trim(json_encode(convert_encoding($sInCharset, $sOutCharset, '阿里巴巴')), '"')));
}