0

単純な文字列変数を単純に保持および取得するクラスを作成しようとしています。

User.php ファイル (クラス) にあるものは次のとおりです。

class User {

//private variables
private $u_s;
private $p_w;

public function _construct($u_s, $p_w){
    $this->u_s = $u_s;
    $this->p_w = md5($p_w);
}

function getUsername(){
    return $this->u_s;
}

function getPassword(){
    return $this->p_w;
}

}

ここにindex.phpファイルがあります

    <?php
       include("User.php");

       $u = new User("Jake", "pass");
       echo $u->getUsername() + "\n" + $u->getPassword();
    ?>

これが機能しないのはなぜですか?

4

2 に答える 2