Autoincrement numeric variable in PHP on Refresh

前端 未结 4 1602
一生所求
一生所求 2021-01-24 08:56

How do I use PHP to auto-increment a numeric variable on page refresh?

Foe example, for $i=10 there is an output of this:

Page has be

4条回答
  •  情歌与酒
    2021-01-24 09:14

    if it's for the same user session, use a session

    session_start();
    if (!isset($_SESSION['counter'])) $_SESSION['counter'] = 0;
    $_SESSION['counter']++;
    

    otherwise, if you want the same count for all users, use database

提交回复
热议问题