The meaning of Session scope

if you use ThinkPHP as a project, you can"t understand the meaning of Session scope.
Why do you set this to work on the server? isn"t session invoked on the server?

https://www.kancloud.cn/manua...

May.08,2022

look at the source code

/**
 * session
 * @access public
 * @param  string        $name session
 * @param  mixed         $value session
 * @param  string|null   $prefix 
 * @return void
 */
public function set($name, $value, $prefix = null)
{
    $this->lock();
    empty($this->init) && $this->boot();
    $prefix = !is_null($prefix) ? $prefix : $this->prefix;
    if (strpos($name, '.')) {
        // 
        list($name1, $name2) = explode('.', $name);
        if ($prefix) {
            $_SESSION[$prefix][$name1][$name2] = $value;
        } else {
            $_SESSION[$name1][$name2] = $value;
        }
    } elseif ($prefix) {
        $_SESSION[$prefix][$name] = $value;
    } else {
        $_SESSION[$name] = $value;
    }
    $this->unlock();
}

you can see from $_ SESSION [$prefix] [$name] = $value; that the purpose of scope is to add an extra layer

Session.php

for use in multiple modules

// 
Session::set('login_user', 'xxxx', 'admin');
// 
Session::set('login_user', 'xxx', 'some');
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36cfc-2c048.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36cfc-2c048.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?