/ Published in: PHP
This class is used to store global information for general access throughout the application.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
class Registry{ function set($k, $v){ self::$entry[$k] = $v; } function get($k){ return self::$entry[$k] ; } return null; } } // Set a value Registry::set('somevar', 'somevalue'); // Get a value $somevar = Registry::get('somevar'); // Store objects if you want $pdo = new PDO($dsn, $dbUsername, $dbPassword); Registry::set('pdo', $pdo);