私はPHP OOPの初心者です。私は、クラスを持っており、出力は空です: NAME1がある-missed POSTが<作業 作業:PHPクラスは何も返しません
$test = new form('name1', 'passw2');
$test->getName();
とクラスは:
<?php
class form
{
protected $username;
protected $password;
protected $errors = array();
function _construct($username, $password){
$this->username=$username;
$this->password=$password;
}
public function getsomething() {
echo '<br>working'. $this->getn() . '<-missed';
}
public function getName(){
return $this->getsomething();
}
public function getn() {
return $this->username;
}
}
?>
、出力はユーザ名なしのテキストのみのですか?
1)') 'あなただけの' getsomething(の戻り値を返すため)、かなり無用である 'とその機能がありませんNULLを返します。 – Rizier123
@ Rizier123どのように私はちょうどこれが道だと言った。 –