Php 在用户会话存在时隐藏中的div
我有一个问题:我无法找到如何隐藏会话开始时出现的div。因此,我有一个X按钮用于关闭,当页面刷新时,div再次出现!但我不想停止这次会议。 我的代码:Php 在用户会话存在时隐藏中的div,php,jquery,session,Php,Jquery,Session,我有一个问题:我无法找到如何隐藏会话开始时出现的div。因此,我有一个X按钮用于关闭,当页面刷新时,div再次出现!但我不想停止这次会议。 我的代码: 如果它处于刷新状态,则很容易;只需在PHP会话中执行;像这样: HTML: 有趣的问题,像这样的怎么样 <?php if(isset($_SESSION['variable'])){ sleep(3); /* Duration(in seconds) div is displayed for */ echo "&l
如果它处于刷新状态,则很容易;只需在PHP会话中执行;像这样:
HTML:
有趣的问题,像这样的怎么样
<?php
if(isset($_SESSION['variable'])){
sleep(3); /* Duration(in seconds) div is displayed for */
echo
"<script>
$( document ).ready(function() {
$(".got-points-bg").hide("fast");
});
</script>";
}
?>
试试这个
<?php error_reporting(0); session_start(); if(empty($_SESSION['user'])) echo "<div id='togglediv'> My text here </div>"; ?>
<div id="got-points" style="display:<?php echo (isset($customer) && !empty($customer) && isset($customer['customer']) && !empty($customer['customer']) && empty($_SESSION['first_load'])) ? 'block' : 'none'; ?>"> // Checks if session is active
<div class="got-points-bg" style="display: visible;">
<div class="got-points-box">
<img class="got-points-close" src="<?php echo base_url();?>static/images/i8.png" /> //Close Button
My text here
</div>
</div>
</div>
<?php
//load user check pseudo code
if !empty($_SESSION[user]) and whatever other checks... {
$_SESSION['first_load'] = False; //important line number 2
}
//login pseudo code to demonstrate placement within your code
if user & pass = valid {
$_SESSION['first_load'] = True; //important line number one
}
<?php
if(isset($_SESSION['variable'])){
sleep(3); /* Duration(in seconds) div is displayed for */
echo
"<script>
$( document ).ready(function() {
$(".got-points-bg").hide("fast");
});
</script>";
}
?>
<?php error_reporting(0); session_start(); if(empty($_SESSION['user'])) echo "<div id='togglediv'> My text here </div>"; ?>