简体   繁体   English

php中的echo命令没有被执行

[英]echo command in php doesn't get executed

echo command is not getting executed. echo 命令没有被执行。

echo "<script>alert('Attendence Updated')</script>";
header("location: http://localhost/classroom/adminportal.php");

If you want to print a message to the user before redirecting, you cannot use header( 'Location: ...' ) , because you cannot send any output before the headers are sent.如果要在重定向之前向用户打印消息,则不能使用header( 'Location: ...' ) ,因为在发送标头之前无法发送任何输出。

You could use following:您可以使用以下内容:

<?php
header("refresh:0; url=http://localhost/classroom/adminportal.php");
echo "<script>alert('Attendence Updated')</script>";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM