# Frequently Asked Questions

TIP

Before you ask, check out the FAQ below.

# session_start()

# /app/ module

  1. thinkphp6 does not support manipulating the native $SESSION array and all functions starting with session
  2. It can only be operated by the Session class (or helper functions)
  3. session data is written uniformly when the current request ends. Therefore, do not execute exit after the Session data is written.
user think\facade\Session;

Session::set('name', 'thinkphp');
Session::get('name');

# /addons/ module

  1. session_start() If repeated startup errors occur, modify the error as follows The session_start() method is replaced with if(! session_id())session_start();
  2. Get into the habit of calling session_commit() manually;
session_start();
// Logical operation XXX
session_commit();

# PHP_EOL error in template

  1. The Thinkphp6 template renders PHP_EOL incorrectly
  2. You can replace PHP_EOL with "\n", using double quotation marks
<body>
<! -- {php}echo PHP_EOL{php} -->
{php}echo "\n"{/php}
</body>