Guest User

Untitled

a guest
Jul 26th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. class Config
  2. {
  3. static $dbHost = 'localhost';
  4. static $dbName = 'name';
  5. static $dbUser = 'user';
  6. static $dbPass = 'pass';
  7. }
  8.  
  9. $this->configService('db', function (ServiceLocator $context) {
  10. return new PDO(
  11. 'mysql:host=' . Config::$dbHost . ';dbname=' . Config::$dbName . ';charset=utf8',
  12. Config::$dbUser,
  13. Config::$dbPass
  14. );
  15. });
  16.  
  17. $this->configService('db', function (ServiceLocator $context) {
  18. $password = Config::$dbPass;
  19. Config::$dbPass = '';
  20.  
  21. return new PDO(
  22. 'mysql:host=' . Config::$dbHost . ';dbname=' . Config::$dbName . ';charset=utf8',
  23. Config::$dbUser,
  24. $password
  25. );
  26. });
Add Comment
Please, Sign In to add comment