Skip to content
Sharafat edited this page Jun 18, 2014 · 2 revisions

Session

Besides usual session data, the Session library also supports Flash data (i.e., data that persists only for the next HTTP request; for example, displaying a success or error message as a result of an operation).

To get the Session library instance, simply call Session::getInstance().

Session Operations

  • setAttribute($key, $value)

    Adds/Replaces a session attribute.

  • getAttribute($key)

    Returns the session attribute value for $key.

  • removeAttribute($key)

    Removes the $key attribute from session.

  • setFlashAttribute($key, $value)

    Adds/Replaces a flash attribute.

  • getFlashAttribute($key)

    Returns the flash attribute value for $key.

For usages of these methods, refer to Home::sessionDemo() method in the example application.

Clone this wiki locally