나는 확장하고있는 기본 클래스가 있지만 기본 클래스에서 정의하는 변수가 하위 클래스에서 액세스 할 수없는 이유는 무엇인지 알 수 없습니다. 나는 그들이 접근을 허용하기 위해 보호되어야한다는 것을 이해했지만 여전히 나를 위해 일하지 않을 것이다.PHP 확장 클래스 상속
class user {
protected static $username;
protected static $password;
protected static $remember;
function __construct() {
}
public function login($username, $password, $remember) {
$this->username = $username;
$this->password = $password;
$this->remember = $remember;
$login = new login();
}
}
class login extends user {
function __construct() {
print("user is: " . $this->username);
die();
}
}
는, 그들은 표시 프로그램의 흐름에 초기화되지 않습니다. – scones