Tag: yii

Phpinheritance,动态属性和新的static()构造函数

我来自.NET世界。 现在进入这些寒冷的php水域。 我发现了一个让我有点困惑的例子。 当然,我试图将OOP基础应用于这个PHP代码,但它没有意义。 这是我正在谈论的课程。 [ ‘id’ => ‘100’, ‘username’ => ‘admin’, ‘password’ => ‘admin’, ‘authKey’ => ‘test100key’, ], ‘101’ => [ ‘id’ => ‘101’, ‘username’ => ‘demo’, ‘password’ => ‘demo’, ‘authKey’ => ‘test101key’, ], ]; public static function findIdentity($id) { return isset(self::$users[$id]) ? new static(self::$users[$id]) : null; } public static function findByUsername($username) { foreach […]