Php 如何检查字符串是否对uudecode有效
我想在使用“convert_uudecode”之前检查$sTring是否已编码,如果$sTring未编码,则不输出任何内容。我收到一条PHP警告:“…给定的参数不是…”中有效的未编码字符串,除非我正确编码了$string。在使用convert_uudecode之前是否需要检查$sTring,或者如果没有编码,是否需要阻止PHP警告Php 如何检查字符串是否对uudecode有效,php,string,uudecode,Php,String,Uudecode,我想在使用“convert_uudecode”之前检查$sTring是否已编码,如果$sTring未编码,则不输出任何内容。我收到一条PHP警告:“…给定的参数不是…”中有效的未编码字符串,除非我正确编码了$string。在使用convert_uudecode之前是否需要检查$sTring,或者如果没有编码,是否需要阻止PHP警告 try{ $sTring='hello'; echo convert_uudecode($sTring); }catch(Exception $e){
try{
$sTring='hello';
echo convert_uudecode($sTring);
}catch(Exception $e){}
谢谢找到了使用警告抑制'@'的方法:
if(@convert_uudecode($sTring))echo convert_uudecode($sTring);
我不打算投票给我自己的答案,希望有人能给出其他更好的答案