PHP Classes

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  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: 2 years ago
Size: 1,016 bytes


Class file image Download
// Require the class file

// 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

// 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.

// Example how to clear session data

// End of file