Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Rubens Takiguti Ribeiro  >  PHP Smart Session  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Exemple of use
Class: PHP Smart Session
Access sessions initialized only when necessary
Author: By
Last change:
Date: 1 year ago
Size: 1,016 bytes
 

Contents

Class file image Download
<?php
// Require the class file
require('SmartSession.php');

// All methods should be called before send anything to browser (any echo).
// You do not need to call session_start for any operation.
// You could configure session before any operation (call session_set_cookie_params or session_name).

// Example how to set a value to session
SmartSession::getInstance()->set('example'123);

// Example how to get a value from session by key
$value SmartSession::getInstance()->get('example');

// Example how to check whether a key exists
$exists SmartSession::getInstance()->has('example');

// Example how to unset a value from session by key
SmartSession::getInstance()->del('example');

// Example how to persist session data
// Note: You can get/set/del session data after calling saveSession,
// but it is better if you call saveSession after all manipulations.
SmartSession::getInstance()->saveSession();

// Example how to clear session data
SmartSession::getInstance()->clearSession();

// End of file