Session Management Directives

Ahmed PHP Template Engine provides multiple directives to manage session data: @makeSession, @getSession, and @deleteSession.

@makeSession - Create a Session Variable

Syntax

@makeSession(name, value)
  • name: The session variable name.

  • value: The value to store.

Example

@makeSession("user", "Ahmed")

@getSession - Retrieve a Session Variable

Syntax

@getSession(name)
  • name: The session variable name.

Example

@var(username, @getSession("user"))
<p>Welcome, @username</p>

@deleteSession - Delete a Session Variable

Syntax

  • name: The session variable name.

Example

Notes

  • Sessions are stored on the server.

  • @makeSession creates or updates a session variable.

  • @getSession retrieves stored session data.

  • @deleteSession removes a specific session variable.

Last updated