我正试图创建一个面向对象的登录系统,却被困在了这个系统上
苏,这是我的课
include_once 'db.php';
class loginHandler extends db {
private $login;
private $password;
private $email;
private $stmt;
public function __construct ($l,$p,$e) {
$this->login = $l;
$this->password = $p;
$this->email = $e;
$this->stmt = $this->connect()->prepare("INSERT INTO users (log,pwd,email) VALUES (?,?,?);");
}
public function send () {
$this->stmt->execute([$this->login,$this->password,$this->email]);
}
}
这就是提交按钮的位置
include 'loginHandler.php';
$log = $_POST['log'];
$pwd = $_POST['pwd'];
$em = $_POST['email'];
$buffer = new loginHandler ($log,$pwd,$em);
$buffer->send();
因此,当它运行时,表字段将填充“null”,而不是来自输入的实际数据
1条答案
按热度按时间5sxhfpxr1#
您需要在发布前添加$符号