PHP中的睡眠问题

时间:2019-04-01 16:04:39

标签: php debugging

我已经尝试了一次又一次,但是看不到什么是错误的,所以请原谅任何不专业的代码,但是我想使程序使用echo显示某些内容,然后在重定向之前先等待,但是睡眠功能会先激活的PHP可以回应我的信息,我该如何解决? 我的代码:

<?php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = $_POST['email_address'];
$to ='lucaswilson4502@outlook.com';
$subject = "Some Feedback";
$message = $_POST['feedback_text'];
$headers = "From:" . $from;
$send_contact=mail($to,$subject,$message,$headers);
if($send_contact){
    echo 'We have received your feedback, Thank you very much!';
        sleep(5);
    echo '<script type="text/javascript"> window.location = "http://www.google.com/" </script>';

} else {
    echo "Oops! There was an error";
}
?>

0 个答案:

没有答案