PHP Header 301重定向在睡眠后什么都不做?

时间:2013-10-01 12:04:35

标签: php .htaccess redirect header imagecreatefrompng

整个想法是创建一个在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不允许该函数执行它的操作。我也尝试将图像创建脚本与确认页面结合起来,但徒劳无功......

谢谢!

0 个答案:

没有答案