有人用过php_strip_whitespace这个方法没,我获得的结果要么是大空白,要么是半截代码,好奇怪
rename.php
$v){
if(IsAnimatedGif('images/'.$v)){
//$img_info = getimagesize('images/'.$v);//Array ( [0] => 400 [1] => 203 [2] => 1 [3] => width="400" height="203" [bits] => 7 [channels] => 3 [mime] => image/gif )
//$img_info = basename('images/'.$v);//pic_uc_1490747710825.jpg
$img_info = pathinfo('images/'.$v);//Array ( [dirname] => images [basename] => pic_uc_1490747710825.jpg [extension] => jpg [filename] => pic_uc_1490747710825 )
if($img_info['extension'] != 'gif'){
rename('images/'.$v, 'images/'.$img_info['filename'].'.gif');
}
}
}
echo 'success';
}
?>
strip_whitespace.php
这是执行strip_whitespace.php最终结果:
$v){ if(IsAnimatedGif('images/'.$v)){ $img_info = pathinfo('images/'.$v); if($img_info['extension'] != 'gif'){ rename('images/'.$v, 'images/'.$img_info['filename'].'.gif'); } } } echo 'success'; } ?>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这是因为你是在浏览器查看结果的,浏览器按照HTML显示了,查看网页源码就可以看到正确结果了。
为什么不直接在CLI模式下运行呢?