任何建議,使這個歡迎郵件短:PHP:讓我的代碼更簡單/短歡迎消息
<?php
if(isset($_SESSION['user_id'])) {
if(isSet($_SESSION['1stTime'])){
?>
<strong id="welcome" style="font-size: 10px;">
<a href="logout.php">
Logga ut
</a>
</strong>
<?php
}else{
$_SESSION['1stTime'] = time();
?>
<script>
$(document).ready(function() {
$("#welcome").fadeIn("slow");
setTimeout(function(){
$("#welcome").fadeOut("slow");
setTimeout(function(){
$("#welcome").html("<a href='logout.php'>Logga ut</a>");
$("#welcome").fadeIn();
}, 800);
}, 5000);
});
</script>
<strong id="welcome" style="display: none; color: #FFF; font-size: 10px;">Hej, <?php echo $FULL; ?>!</strong>
<?php
}
}
?>
首先,它會檢查,如果你在接下來簽署,如果1stTime設置,如果是則顯示「。退出」在瑞典,如果它不是,然後介紹‘嗨,NAME’,然後更改爲‘5秒(jQuery的)後退出’+設置會話
我怎樣才能使這個更簡單?