开发者

Auto increment a variable in session [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.开发者_如何学Python Closed 10 years ago.

How do I auto increment a value inside a session which will be used multiple times in a certain page.


$_SESSION['value']++ will do the trick, then output your variable on the page

<?php echo $_SESSION['value']; ?>

Something to consider is that $_SESSION['value'] should be set first, perhaps at the top of your page. You can add this if you wish to check:

<?php echo isset($_SESSION['value'])?$_SESSION['value']:''; ?>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜