0

我的项目中有用于登录和注册的 php 类,如何在我的 registration.php 文件中包含该类并创建对象,当我通过包含函数包含时,会发生此错误解析错误:语法错误,C:\ 中的意外 T_OBJECT_OPERATOR wamp\www\loginoops\user1.php 在第 9 行,请帮助我。下面的代码ID-

<?php 
include_once("connection.php");
class User1{
public $username=null;
public $password=null;
public $mobile=null;
public $email=null;
public function _construct($data=array()){
if(isset($data['name'])){this->$username=stripcslashes(strip_tags($data['name']));
}
if(isset($data['pass'])){this->$password=stripcslashes(strip_tags($data['pass']));}
if(isset($data['mobile'])){this->$mobile=stripcslashes(strip_tags($data['mobile']));}
if(isset($data['email'])){this->$password=stripcslashes(strip_tags($data['email']));}

}
public function storeFormValue($param){
this->_construct($param);
}
public function regUser($con){
$success=null;
try{
$sql="insert into user        values('".$username."','".$password."','".$mobile."','".$email."')";
if(mysqli_query($con,$sql)
{
return "Registration Successful <br/> <a href='Register.php'>Login Now</a>";

}


}
catch(Exception $e)
{
return  $e->getMessage();
}

}

}
?>
4

1 回答 1

1

您需要使用$this代替this$this->username代替this->$username

于 2013-10-09T06:51:40.050 回答