使用会话ID修改PHP会话

If a session id is stored can it be used to alter session data such as an array variable?

I am working on a project for a login system in PHP where the login authentication comes from an out-of-band source (mobile app or browser extension).

The browser page will use JavaScript to continuously request the login state from the server. The user will scan a QR Code on the page for example, and their phone will post their authentication by API to the server.

I would then like to alter the $_SESSION data associated with the session on the page that was issued with that specific QR Code. I can know the session id which issued that specific QR Code which data was returned by the mobile QR Code scan, but can I use the session id to modify the session data, so as to set the SESSION state to logged in?

I have looked through the PHP manual for a function that would allow this to modify another session but didn't find anything. (https://www.php.net/manual/en/ref.session.php)

in view set textbox value with $_SESSION id, and when action, update data SESSION with id to database.

What you do is you set your session_id to the id data you want to edit then change the session values.

 session_id('the id you have');
    session_start();
    $_SESSION['anydata'] = 'whatever you want';