<?php
namespace Config;
/**
* mysql配置
* @author walkor
*/
class Db
{
public static $db3 = [];
public function __construct()
{
}
public static function getInstance()
{
$database = include __DIR__ . "/../../../../../data/conf/database.php";
return self::$db3 = array(
'host' => $database['hostname'],
'port' => $database['hostport'],
'user' => $database['username'],
'password' => $database['password'],
'dbname' => $database['database'],
'charset' => 'utf8'
); # 给静态变量赋值
}
}
$PJ = new Db();
$PJ->getInstance();
php类的static变量赋值