整个想法是创建一个在 php 中制作图像的表单,然后您有一个确认页面以将其作为电子邮件发送。
它适用于我的网络托管服务,但考虑到easyPHP,它无法在我的计算机上运行。它什么都不做,完整的图像停留在屏幕上并且不会重定向。
<?php
header( "Content-type: image/png" );
ob_start();
if(!isset($_POST['name']) ||
!isset($_POST['birth']) ||
!isset($_POST['date']) ||
!isset($_POST['asiakasnumero']))
{
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name']; // required
$birth = $_POST['birth']; // required
$date = $_POST['date']; // required
$asiakasnumero = $_POST['asiakasnumero']; // required
$my_img = @imagecreatefrompng('card.png');
$text_colour = imagecolorallocate( $my_img, 255, 255, 255 );
imagestring( $my_img, 3, 240, 155, $name,
$text_colour );
imagestring( $my_img, 3, 240, 215, $birth,
$text_colour );
imagestring( $my_img, 3, 240, 273, $date,
$text_colour );
imagestring( $my_img, 3, 140, 327, $asiakasnumero,
$text_colour );
$image_path = "images/card".".png";
imagesetthickness ( $my_img, 5 );
imagepng( $my_img );
imagecolordeallocate($my_img , $text_colour );
imagepng($my_img, $image_path);
imagedestroy( $my_img );
ob_end_flush();
sleep(5);//seconds to wait..
header('HTTP/1.1 301 Moved Permanently'); //optional
header("Location: http://www.domain.com");
exit();
?>
我曾尝试使用 .htaccess 来重定向它,但 htaccess 不允许该函数执行其操作。我还尝试将图像创建脚本与确认页面结合起来,但徒劳无功......
谢谢!