開発中に問題に直面しました。imagedestroy を呼び出した後、私のスクリプトは一部の PHP や HTML を実行しません。
ヘッダーを削除すると、イメージの破棄後に PHP/HTML が実行されますが、スクリプトでそのヘッダーが必要です。私の質問は次のとおりです。PHP ヘッダーは PHP スクリプトにどのように影響しますか。
<?php
header('Content-Type: image/png;');
$im = @imagecreatefrompng('ticket.png') or die("Cannot select the correct image. Please contact the webmaster.");
$text_color = imagecolorallocate($im, 0,0,0);
/*
$name = $_GET['name'];
$from = $_GET['from'];
$to = $_GET['to'];
$time = $_GET['time'];
$date = $_GET['date'];
$agent = $_GET['agent'];
$sno = $_GET['sno'];
$flightno = $_GET['flightno'];
$boardingtime = $_GET['boardingtime'];
$gate = $_GET['gate'];
$seat = $_GET['seat'];
*/
$name = $_POST['name'];
$from = $_POST['from'];
$to = $_POST['to'];
$time = $_POST['time'];
$date = $_POST['date'];
$agent = $_POST['agent'];
$sno = rand(101, 199);
$flightno = $_POST['flightno'];
$boardingtime = $_POST['boardingtime'];
$gate = $_POST['gate'];
$seat = $_POST['seat'];
$text_name = "$name";
$text_from = "$from";
$text_to = "$to";
$text_time = "$time";
$text_date = "$date";
$text_agent = "$agent";
$text_sno = "$sno";
$text_flightno = "$flightno";
$text_boardingtime = "$boardingtime";
$text_gate = "$gate";
$text_seat = "$seat";
$font = 'font.ttf';
#Basis in het midden.
imagettftext($im, 12, 0, 119, 168, $text_color, $font, $text_name);
imagettftext($im, 12, 0, 119, 184, $text_color, $font, $text_from);
imagettftext($im, 12, 0, 100, 201, $text_color, $font, $text_to);
imagettftext($im, 12, 0, 185, 235, $text_color, $font, $text_time);
imagettftext($im, 12, 0, 498, 167, $text_color, $font, $text_date);
imagettftext($im, 12, 0, 509, 184, $text_color, $font, $text_agent);
imagettftext($im, 21, 0, 544, 260, $text_color, $font, $text_sno);
#Top
imagettftext($im, 14, 0, 97, 85, $text_color, $font, $text_flightno);
imagettftext($im, 14, 0, 289, 85, $text_color, $font, $text_boardingtime);
imagettftext($im, 14, 0, 398, 85, $text_color, $font, $text_gate);
imagettftext($im, 14, 0, 486, 85, $text_color, $font, $text_seat);
$rand = rand(0, 3498);
imagepng($im);
imagepng($im, 'images/' . $rand . '.png');
imagedestroy($im);
echo 'This does not display';
?>