최근에 PHP를 시작한 후 __construct()와 클래스와 이름이 같은 메소드가 다른지 궁금합니다.__construct() 클래스와 동일한 이름을 가진 메소드
왜 사용해야합니까? 내가 해결할 수있는 것은 푸 (Foo)라는 메소드를 오버라이드하거나 선호하는 것인가?
예.
class Foo {
function Foo()
{
echo 'Foo stated<br>';
}
function __construct() {
echo 'Construct started<br>';
}
}
감사
PHP의 생성자에 대한 [\ _ \ _ construct() 대 SameAsClassName()의 가능한 복제본] (http://stackoverflow.com/questions/217618/construct-vs-sameasclassname-for-constructor-in-php) – nawfal