我的班级
中有关于某个功能的错误<?php require_once $_SERVER['DOCUMENT_ROOT'].'/SITEBOUSILLE/models/utilisateur.php';
class formInscription {
private $user;
public function __construct(){
$this->user = new Utilisateur();
}
public function inscription($pseudo, $login, $password, $mail);{
session_start();
$row = $this->user->setUser($pseudo, $login, $password, $mail);
header ("Location: /SITEBOUSILLE ");
}
}
?>
我的导航员告诉我这个:
致命错误:非抽象方法formInscription :: inscription()必须&gt;在第12行的C:\ wamp \ www \ SITEBOUSILLE \ controler \ inscription \ controleur_inscription_form.php中包含正文
我真的不知道为什么会出现这个错误,因为我有几乎完全相同的类(但对于连接)并且它完美地运行...
以下是“utilisateur”类的代码,以防万一......
<?php
require_once $_SERVER['DOCUMENT_ROOT'].'/SITEBOUSILLE/models/model.php';
class Utilisateur extends Modele{
function getUser($login, $password){
$requete = "SELECT * FROM utilisateur WHERE login LIKE '$login' AND password LIKE '$password'";
$ex = $this->getBdd()->query($requete);
$ex = $ex->fetch();
return $ex;
}
function setUser($pseudo, $login, $password, $mail){
$requete = "INSERT INTO utilisateur SET pseudo='$pseudo' , login ='$login', password='$password', mail='$mail', codeNiveauSecurite=1, avatar='http://image.noelshack.com/fichiers/2015/13/1427481769-dot100.gif' ";
$ex = $this->getBdd()->query($requete);
}
}
?>
编辑:谢谢你......我很失明......
答案 0 :(得分:4)
public function inscription($pseudo, $login, $password, $mail);{
^
Get rid of this semi-colon
答案 1 :(得分:2)
在函数定义之后有一个;
,所以该方法没有得到它的主体。删除;
-
public function inscription($pseudo, $login, $password, $mail) {
您的代码 -
public function inscription($pseudo, $login, $password, $mail);{
答案 2 :(得分:0)
您在 $ mail)
之后缺少;
语法错误
class formInscription {
private $user;
public function __construct(){
$this->user = new Utilisateur();
}
public function inscription($pseudo, $login, $password, $mail){
session_start();
$row = $this->user->setUser($pseudo, $login, $password, $mail);
header ("Location: /SITEBOUSILLE ");
}
}
?>