我有一个奇怪的问题,无法进入课堂$_POST
,很奇怪,这是问题和错误?类很简单,只是为了演示。
if(isset($_POST['name']))
{
$name=$_POST['name'];
$email=$_POST['email'];
$comment=$_POST['comment'];
$komentar = new comments($name,$email,$comment);
$komentar->provera();
}
班级:
class comments
{
public function __construct($name, $email, $comment)
{
$this->name=$name;
$this->email=$email;
$this->comment=$comment;
}
public static function provera()
{
$poruka=$this->comment;
echo $poruka;
}
}
我收到了这个错误
Fatal error: Using $this when not in object context in
classes\comments.inc.php on line 12