API15:JSession/getToken
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Get a session token, if a token isn't set yet one will be generated.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
getToken($forceNew=false)
| Parameter Name | Default Value | Description |
|---|---|---|
| $forceNew | false | $forceNew If true, force a new token to be created public |
Returns
string The session token
Defined in
libraries/joomla/session/session.php
Importing
jimport( 'joomla.session.session' );
Source Body
function getToken($forceNew = false) { $token = $this->get( 'session.token' ); //create a token if( $token === null || $forceNew ) { $token = $this->_createToken( 12 ); $this->set( 'session.token', $token ); } return $token; }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
