为什么不呢
public static $CURRENT_TIME = time() + 7200;
Run Code Online (Sandbox Code Playgroud)
工作(错误):
解析错误:语法错误,意外'('
但
class Database {
public static $database_connection;
private static $host = "xxx";
private static $user = "xxx";
private static $pass = "xxx";
private static $db = "xxx";
public static function DatabaseConnect(){
self::$database_connection = new mysqli(self::$host,self::$user,self::$pass,self::$db);
self::$database_connection->query("SET NAMES 'utf8'");
return self::$database_connection;
}
}
Run Code Online (Sandbox Code Playgroud)
确实有效.
我是OOP的新手,我很困惑.