web.session

web.session

web.session

Function

Read and save the current request Session object.

Syntax

Parameters

No parameters.

Return value

TypeDescription
ObjectReturns the Session object of the current request.

Object structure

FieldTypeDescription
Any Session key nameAnyThe value saved in the current Session. Supports JSON expressible String, Int, Float, Bool, Array, Object, and Null; when the key does not exist, the read result is Empty.

Example

Notes

  • The bottom layer of Session saves JSON strings in __bt_session_json.
  • At the end of the request, web.session will be serialized into JSON and saved.
  • Non-JSON basic values such as Fs, functions, and class instances will be written to the Session as strings. It is not recommended to directly save such runtime objects.