To view the result in a human-readable format use:
include the class
require 'path/to/Zebra_Session.php';
instantiate the class
$session = new Zebra_Session();
get default settings
print_r('
');
print_r($session->get_settings());
would output something similar to (depending on your actual settings)
Array
(
[session.gc_maxlifetime] => 1440 seconds (24 minutes)
[session.gc_probability] => 1
[session.gc_divisor] => 1000
[probability] => 0.1%
)
public get_settings ( ) : array | ||
return | array |
$username = ''; $password = ''; // this is the name of the database where you created the table used by this class $database = 'salesreport'; // try to connect to the MySQL server $link = mysqli_connect($host, $username, $password, $database) or die('Could not connect to database!'); // include the Zebra_Session class require '../Zebra_Session.php'; // instantiate the class // note that you don't need to call the session_start() function // as it is called automatically when the object is instantiated // also note that we're passing the database connection link as the first argument $session = new Zebra_Session($link, 'sEcUr1tY_c0dE'); // current session settings print_r('<pre><strong>Current session settings:</strong><br><br>'); print_r($session->get_settings()); print_r('</pre>'); // from now on, use sessions as you would normally // the only difference is that session data is no longer saved on the server // but in your database print_r(' The first time you run the script there should be an empty array (as there\'s nothing in the $_SESSION array)<br> After you press "refresh" on your browser, you will se the values that were written in the $_SESSION array<br> '); print_r('<pre>'); print_r($_SESSION); print_r('</pre>'); // add some values to the session $_SESSION['value1'] = 'hello'; $_SESSION['value2'] = 'world'; // now check the table and see that there is data in it!