在想象php liberary(imagick)中处理损坏URL的错误

This code works normally with valid image URL

$src = url_path_encode($src);
$imagine = new Imagine\Imagick\Imagine();
$watermark = $imagine->open(WATERMARK);
$img=$imagine->open($src);
.
.
.

But when the URL is broken I get a Fatal error that stop all scripts! How can I handling this error? If the URL is broken only skip it?

Just use exception handling for this:

try {
  $img=$imagine->open($src);
}
catch (RuntimeException $e) {
  //do your exception handling here
}