can a php $_SESSION variable have numeric id thus : $_SESSION['1234’]

后端 未结 3 1278
难免孤独
难免孤独 2020-12-20 23:14

I\'ve been driving myself nuts with this problem.

I\'m creating a session id dynamically in order to retain the page state on refresh.

If a page element is c

3条回答
  •  情书的邮戳
    2020-12-20 23:45

    It's bad practise to have an all numeric element id (i.e.

    ) - you should place at least one alpha character, e.g.
    . This should solve your problem - alternatively you can just add the the alpha character when creating the session then remove it if the page is refreshed:

    $_SESSION[$id] = substr($str, 0, 1);

提交回复
热议问题