Итак, у меня есть этот код:PHP проблема с матрицей()
} else {
$photograph_moderation = new PhotographModeration($this->photograph_id);
$photograph_moderation->purgePhotograph();
//eventually take to an error page
die('image is not big enough to upload');
}
функция purgePhotograph() вызывается должным образом, когда это условие выполняется, но сценарий никогда не появляется, чтобы умереть. Есть ли причина, по которой смерть не будет вызвана здесь? purgePhotograph() не имеет команд убийства скриптов.
Вот функция purge_photograph:
public function purgePhotograph() {
$db = Connect::connect();
$photograph_id = $db->real_escape_string($this->photograph_id);
$query = "SELECT * from photographs WHERE id='{$this->photograph_id}'";
$result = $db->query($query);
$photograph = $result->fetch_assoc();
if ($photograph['location'])
unlink($photograph['location']);
if ($photograph['thumbnail_location'])
unlink($photograph['thumbnail_location']);
if ($photograph['watermark_location'])
unlink($photograph['watermark_location']);
if ($photograph['xsmall_location'])
unlink($photograph['xsmall_location']);
if ($photograph['small_location'])
unlink($photograph['small_location']);
if ($photograph['medium_location'])
unlink($photograph['medium_location']);
if ($photograph['large_location'])
unlink($photograph['large_location']);
if ($photograph['xlarge_location'])
unlink($photograph['xlarge_location']);
if ($photograph['xxlarge_location'])
unlink($photograph['xxlarge_location']);
if ($photograph['xxxlarge_location'])
unlink($photograph['xxxlarge_location']);
$query = "DELETE from photographs WHERE id='{$this->photograph_id}'";
$result = $db->query($query);
$query = "DELETE from photograph_tags WHERE photograph_id='{$this->photograph_id}'";
$result = $db->query($query);
}
Вы на самом деле попробовали это только с тремя строками, которые вы предоставляете, без промежуточных вещей? – Anthony
Я никогда не видел, как умирает(). Почему вы так уверены, что purgePhotograph() когда-либо выходит? – timdev
@ Энтони: Я думаю, что это комментарий TODO, как и в, в конце концов замените 'die' страницей с ошибкой :-) – Josh