Using same session ID within two PHP scripts at same time

前端 未结 2 443
一整个雨季
一整个雨季 2021-01-14 08:44

I have ocassionally detected a strange problem with PHP sessions.
When I am running two PHP scripts using SAME session ID, second script is stuck until first one is comp

2条回答
  •  孤独总比滥情好
    2021-01-14 09:15

    Yes, this is called "session locking" and is normal in PHP.

    One solution is not not use sessions, just set cookies for your required persistent information.

    Another solution is to implement your own session handler:

    http://php.net/manual/en/session.customhandler.php

    A detailed walkthrough about custom MySQL session handlers is here:

    http://phpmaster.com/writing-custom-session-handlers/

提交回复
热议问题