【发布时间】:2021-10-03 14:31:17
【问题描述】:
当我运行这段代码时:
$img = new Imagick('ttt.jpg');
$quality = $img->getImageCompressionQuality();
echo $quality;
然后我得到错误:
PHP Fatal error: Uncaught ImagickException: open_basedir restriction in effect. File(ttt.jpg) is not within the allowed path(s)
脚本崩溃了。
我知道要解决这个问题,但我如何才能在它发生之前检查它是否会发生?
我试过这个:
$readable = @is_readable('ttt.jpg');
if(!$readable) {
echo 'not readable';
}else{
$img = new Imagick('ttt.jpg');
$quality = $img->getImageCompressionQuality();
echo $quality;
}
但条件始终为真
【问题讨论】:
-
不能解决您的问题,但请摆脱
@。你不想抑制任何错误。你想修复它们。 -
好的,谢谢@B001ᛦ
标签: php