我认为有一种方法是先检查 POST 变量 IMG 是否存在。然后使用 PHP Explode() 函数分解其内容。$image_urls = array(); //blank array assuming there are no image URLsif(isset($_POST['IMG'])){ $image_urls = explode('|', $_POST['IMG']); }//Below code will check if the array actually has image URL parts from //POST variable IMGif(count($image_urls) > 0){ //your code to process the images}