小编Ali*_*roi的帖子

PHP how to echo alert before header redirects to another page

I'm trying to make a functionality where, after the user logs in, an alert will popup saying "welcome USER_NAME", after which it will redirect to the user profile page.

I tried the sleep & flush methods, and even ob_start & ob_end_flush methods..but nothing seems to work, it just redirects to user profile after logging in without echoing the alert. Is there any way of fixing this problem?

Here is the part of the code:

<?php
if (isset($_SESSION['user'])) {
``$_SESSION['user'] = …
Run Code Online (Sandbox Code Playgroud)

php header echo

2
推荐指数
1
解决办法
195
查看次数

标签 统计

echo ×1

header ×1

php ×1