php实现try catch跳过错误继续执行,不终止程序。
不加try catch时

return iconv($encoding,$this->_outEncoding,$string);

v1.png

加try catch后

try {
   return iconv($encoding,$this->_outEncoding,$string);
}
catch(\Exception $e) {
    return 1;
}

v2.png

修正错误处理方式

try {
   return iconv($encoding,$this->_outEncoding,$string);
}
catch(\Exception $e) {
   //return mb_convert_encoding($string,"GBK","UTF-8");
   return mb_convert_encoding($string,$this->_outEncoding,$encoding);
}