SessionComponent Class Reference

Public Member Functions | |
| activate ($base=null) | |
| check ($name) | |
| del ($name) | |
| delete ($name) | |
| destroy () | |
| error () | |
| id ($id=null) | |
| initialize (&$controller) | |
| read ($name=null) | |
| renew () | |
| setFlash ($message, $layout= 'default', $params=array(), $key= 'flash') | |
| startup (&$controller) | |
| valid () | |
| write ($name, $value=null) | |
Detailed Description
Definition at line 41 of file session.php.
Member Function Documentation
| SessionComponent::activate | ( | $ | base = null |
) |
Starts Session on if 'Session.start' is set to false in core.php
- Parameters:
-
string $base The base path for the Session public
Definition at line 103 of file session.php.
| SessionComponent::check | ( | $ | name | ) |
Used to check if a session variable is set
In your controller: $this->Session->check('Controller.sessKey');
- Parameters:
-
string $name the name of the session key you want to check
- Returns:
- boolean true is session variable is set, false if not public
Reimplemented from CakeSession.
Definition at line 196 of file session.php.
| SessionComponent::del | ( | $ | name | ) |
Used to delete a session variable.
In your controller: $this->Session->del('Controller.sessKey');
- Parameters:
-
string $name the name of the session key you want to delete
- Returns:
- boolean true is session variable is set and can be deleted, false is variable was not set. public
Reimplemented from CakeSession.
Definition at line 164 of file session.php.
Referenced by delete().
| SessionComponent::delete | ( | $ | name | ) |
Wrapper for SessionComponent::del();
In your controller: $this->Session->delete('Controller.sessKey');
- Parameters:
-
string $name the name of the session key you want to delete
- Returns:
- boolean true is session variable is set and can be deleted, false is variable was not set. public
Definition at line 180 of file session.php.
References del().
| SessionComponent::destroy | ( | ) |
Used to destroy sessions
In your controller: $this->Session->destroy();
public
Reimplemented from CakeSession.
Definition at line 272 of file session.php.
| SessionComponent::error | ( | ) |
Used to determine the last error in a session.
In your controller: $this->Session->error();
- Returns:
- string Last session error public
Reimplemented from CakeSession.
Definition at line 211 of file session.php.
| SessionComponent::id | ( | $ | id = null |
) |
Returns Session id
If $id is passed in a beforeFilter, the Session will be started with the specified id
- Parameters:
-
$id string
- Returns:
- string public
Reimplemented from CakeSession.
Definition at line 288 of file session.php.
References CakeSession::$id.
| SessionComponent::initialize | ( | &$ | controller | ) |
Initializes the component, gets a reference to Controller::$param['bare'].
- Parameters:
-
object $controller A reference to the controller public
Definition at line 81 of file session.php.
References params().
| SessionComponent::read | ( | $ | name = null |
) |
Used to read a session values for a key or return values for all keys.
In your controller: $this->Session->read('Controller.sessKey'); Calling the method without a param will return all session vars
- Parameters:
-
string $name the name of the session key you want to read
- Returns:
- mixed value from the session vars public
Reimplemented from CakeSession.
Definition at line 148 of file session.php.
| SessionComponent::renew | ( | ) |
Used to renew a session id
In your controller: $this->Session->renew();
public
Reimplemented from CakeSession.
Definition at line 244 of file session.php.
| SessionComponent::setFlash | ( | $ | message, | |
| $ | layout = 'default', |
|||
| $ | params = array(), |
|||
| $ | key = 'flash' | |||
| ) |
Used to set a session variable that can be used to output messages in the view.
In your controller: $this->Session->setFlash('This has been saved');
Additional params below can be passed to customize the output, or the Message.[key]
- Parameters:
-
string $message Message to be flashed string $layout Layout to wrap flash message in array $params Parameters to be sent to layout as view variables string $key Message key, default is 'flash' public
Definition at line 231 of file session.php.
| SessionComponent::startup | ( | &$ | controller | ) |
Startup method.
- Parameters:
-
object $controller Instantiating controller public
Definition at line 92 of file session.php.
| SessionComponent::valid | ( | ) |
Used to check for a valid session.
In your controller: $this->Session->valid();
- Returns:
- boolean true is session is valid, false is session is invalid public
Reimplemented from CakeSession.
Definition at line 258 of file session.php.
| SessionComponent::write | ( | $ | name, | |
| $ | value = null | |||
| ) |
Used to write a value to a session key.
In your controller: $this->Session->write('Controller.sessKey', 'session value');
- Parameters:
-
string $name The name of the key your are setting in the session. This should be in a Controller.key format for better organizing string $value The value you want to store in a session. public
Reimplemented from CakeSession.
Definition at line 120 of file session.php.
Referenced by setFlash().
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/controller/components/session.php