2019-04-12 09:29
浏览 92


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:

if (isset($_SESSION['user'])) {
``$_SESSION['user'] = $uname;
``echo "<script> alert('Welcome $uname')</script>";
``header("location: dashboard.php");

图片转代码服务由CSDN问答提供 功能建议

我正在尝试创建一个功能,在用户登录后,会弹出一条警告“欢迎USER_NAME” “,之后它将重定向到用户个人资料页面。

我尝试了睡眠&amp; 冲洗方法,甚至是ob_start&amp; ob_end_flush方法..但似乎什么都没有用,它只是在登录后重定向到用户配置文件而不回显警报。 有没有办法解决这个问题?


if(isset)  ($ _SESSION ['user'])){
`` $ _SESSION ['user'] = $ uname; 
``echo“&lt; script&gt; alert('Welcome $ uname')&lt; / script&gt;”  ; 
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

相关推荐 更多相似问题