SessionInterface
Extends IteratorAggregateInterface defining a Joomla! Session object
since |
2.0.0 |
---|---|
package |
Joomla Framework |
Methods
abort
Aborts the current session
abort() : bool
see | session_abort() |
---|---|
since |
2.0.0 |
Response
bool
all
Retrieves all variables from the session store
all() : array
since |
2.0.0 |
---|
Response
array
clear
Clears all variables from the session store
clear() : void
since |
2.0.0 |
---|
close
Writes session data and ends session
close() : void
Session data is usually stored after your script terminated without the need to call SessionInterface::close(), but as session data is locked to prevent concurrent writes only one script may operate on a session at any time. When using framesets together with sessions you will experience the frames loading one by one due to this locking. You can reduce the time needed to load all the frames by ending the session as soon as all changes to session variables are done.
see | session_write_close() |
---|---|
since |
2.0.0 |
destroy
Frees all session variables and destroys all data registered to a session
destroy() : bool
This method resets the $_SESSION variable and destroys all of the data associated with the current session in its storage (file or DB). It forces new session to be started after this method is called. It does not unset the session cookie.
see | session_destroy() session_unset() |
---|---|
since |
2.0.0 |
Response
bool
fork
Create a new session and copy variables from the old one
fork() : bool
since |
2.0.0 |
---|
Response
bool
gc
Perform session data garbage collection
gc() : int|bool
see | session_gc() |
---|---|
since |
2.0.0 |
Response
int|bool
Number of deleted sessions on success or boolean false on failure or if the function is unsupported
get
Get data from the session store
get(string name, mixed default = null) : mixed
since |
2.0.0 |
---|
Arguments
- name
string
Name of a variable- default
mixed
Default value of a variable if not set
Response
mixed
Value of a variable
getExpire
Get expiration time in seconds
getExpire() : int
since |
2.0.0 |
---|
Response
int
The session expiration time in seconds
getId
Get the session ID
getId() : string
since |
2.0.0 |
---|
Response
string
The session ID
getName
Get the session name
getName() : string
since |
2.0.0 |
---|
Response
string
The session name
getToken
Get a session token.
getToken(bool forceNew = false) : string
Tokens are used to secure forms from spamming attacks. Once a token has been generated the system will check the request to see if it is present, if not it will invalidate the session.
since |
2.0.0 |
---|
Arguments
- forceNew
bool
If true, forces a new token to be created
Response
string
has
Check whether data exists in the session store
has(string name) : bool
since |
2.0.0 |
---|
Arguments
- name
string
Name of variable
Response
bool
True if the variable exists
hasToken
Check if the session has the given token.
hasToken(string token, bool forceExpire = true) : bool
since |
2.0.0 |
---|
Arguments
- token
string
Hashed token to be verified- forceExpire
bool
If true, expires the session
Response
bool
isActive
Check if the session is active
isActive() : bool
since |
2.0.0 |
---|
Response
bool
isNew
Check whether this session is newly created
isNew() : bool
since |
2.0.0 |
---|
Response
bool
isStarted
Check if the session is started
isStarted() : bool
since |
2.0.0 |
---|
Response
bool
remove
Unset a variable from the session store
remove(string name) : mixed
since |
2.0.0 |
---|
Arguments
- name
string
Name of variable
Response
mixed
The value from session or NULL if not set
restart
Restart an expired or locked session
restart() : bool
see | destroy |
---|---|
since |
2.0.0 |
Response
bool
True on success
set
Set data into the session store
set(string name, mixed value = null) : mixed
since |
2.0.0 |
---|
Arguments
- name
string
Name of a variable.- value
mixed
Value of a variable.
Response
mixed
Old value of a variable.
setId
Set the session ID
setId(string id) : $this
since |
2.0.0 |
---|
Arguments
- id
string
The session ID
Response
$this
setName
Set the session name
setName(string name) : $this
since |
2.0.0 |
---|
Arguments
- name
string
The session name
Response
$this
start
Start a session
start() : void
since |
2.0.0 |
---|