doulilou8560 2019-05-07 02:02
浏览 73

如何在数据库中更改用户数据后用php刷新页面?

I'm trying to make a page to verify users and once they get verified it should automatically display the new content.

I've already tried with:

<?php if ($user[ 'verified']) echo '<META HTTP-EQUIV="Refresh" Content="0; URL='.$location.'">'; ?>

But the issue with this is that if the user is verified the site keeps constantly refreshing.

<div class="notverified" <?php if ($user[ 'verified']) echo 'style="display:contents;"'; ?>>
   <span>You are verified (example)</span>
</div>

I expect that automatically appears the new content once the user is verified in db OR that once the user is verified, the site reloads but only one time.

  • 写回答

2条回答 默认 最新

  • doukengsha9472 2019-05-07 02:27
    关注

    the problem is you refresh the page, instead of using ajax to get content.

    <?php if ($user[ 'verified']) echo '<META HTTP-EQUIV="Refresh" Content="0; URL='.$location.'">'; ?>
    

    when the user verified == true, the browser refresh, and the next time the user verified == true again, and of course, the site keeps constantly refreshing.

    so, if the $user verified, you should trigger the ajax for getting new content.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分