function mongo_connection() { extract(mongo_config()); $dsn = implode(',', array_map(function ($node) { return $node['host'] . ':' . $node['port']; }, $nodes)); $conn = new MongoClient('mongodb://' . $dsn); return array($conn->{$database}, $conn); }
<?php // init view path view_path(__DIR__ . '/../view/'); db_config(array('host' => '127.0.0.1', 'username' => 'root', 'password' => '', 'database' => 'passwd')); // init mongo config mongo_config(array('database' => 'test')); $GLOBALS['keys'] = "ADOCXLIE213WADACVTWE32`123"; // init 404 handler if_not_found(function ($msg = '') { return render('notfound'); }); $GLOBALS['redisConfig'] = array('scheme' => 'tcp', 'host' => '127.0.0.1', 'port' => 6379); $GLOBALS['redisCacheTime'] = 3600;