我为我的服务器帐户构建了用户类。编写一个调用类实例本身的add()函数是否聪明?这不是一个错误的方法吗?
class cUser
{
private $login, $pass;
public static $users = array(), $userstmp, $datatmp, $usernew;
private static $datafile = "CuserData.txt";
function __construct()
{
$this->login = $_POST['slogin'];
$this->pass = $_POST['spass'];
}
public static function userAdd ()
{
self::$usernew = new cUser(); // <--- HERE ---<
self::$users[ self::$usernew->login ] = self::$usernew;
self::dataStore();
}
}