出于某种原因,我收到此错误:
致命错误:第 13 行 C:\xampp\htdocs\school\blom\inlog dinkie\engine\class.php 中允许的内存大小为 134217728 字节已用尽(试图分配 36 字节)
在这段代码上:
<?php
class gebruiker extends start{
private $_login_form;
public $log_in;
public $logged_in;
function __construct(){
$this->logged_in = false;
$this->_login_form = new login_form();
parent::html($this->_login_form);
}
function log_in(){
$html = $this->_login_form;
if($this->log_in){
$go = true;
if(!$_REQUEST['naam']){
$this->_login_form->error_naam = 'vul je naam in!';
$go = false;
}
else{
$this->_login_form->naam = $_REQUEST['naam'];
}
if(!$_REQUEST['pass']){
$this->_login_form->error_pass = 'vul je pass in!';
$go = false;
}
else{
$this->_login_form->pass = $_REQUEST['pass'];
}
//go log in
$html = $dom->saveHTML();
}
parent::html($this->_login_form->form());
}
}
class login_form extends gebruiker{
protected $html;
protected $error_naam = ' ';
protected $error_pass = ' ';
protected $naam = '';
protected $pass = '';
function form(){
$this->html = ' <center>
<div style="border:1px dotted rgb(169, 169, 169); width:572px; height:196px; background-color:rgba(40, 152, 250, 0.670588);margin-top:200px;">
<h4 id="title">Inloggen</h4>
<br>
<form action="./?login" method="post">
<table>
<tr>
<td id="error_naam">'.$error_naam.'</td>
<td id="error_pass">'.$error_pass.'</td>
</tr>
<tr>
<td><input id="naam" type="text" placeholder="naam" name="naam" value="'.$naam.'" /></td>
<td><input id="pass" type="password" placeholder="wachtwoord" name="pass" value="'.$pass.'" /></td>
</tr>
<tr>
<td><input type="submit" value="Inloggen" /></td>
<td></td>
</tr>
</table>
</div>
</center>';
return $this->html;
}
}
?>
这是这个的后端:
<?php
include_once('engine/database.php');
include_once('engine/class.php');
$start = new start();
class start{
private $_html;
function __construct(){
session_start();
if(isset($_SESSION['gebruiker'])){
if(isset($_REQUEST['login'])){
$_SESSION['gebruiker']->log_in = true;
$_SESSION['gebruiker']->log_in();
}
elseif(isset($_REQUEST['register'])){
//register
}
elseif(!$_SESSION['gebruiker']->logged_in){
$_SESSION['gebruiker']->log_in = false;
$_SESSION['gebruiker']->log_in();
}
else{
switch($_REQUEST['actie']){
case 'iets':
//dostuf
break;
default:
echo 'deafauasdfasdr';
break;
}
}
}
else{
$_SESSION['gebruiker'] = new gebruiker();
//$new = new gebruiker();
}
}
protected function html($html = 'emty'){
$this->_html = $html;
}
function __destruct(){
echo $this->_html;
}
}
?>
现在我认为我收到此错误是因为我将gebruiker()
类存储在$_SESSION
. 我没有声明很多代码,所以我不明白为什么会达到内存限制。
或者是因为我不能在 a 中存储一个有这么多扩展的函数类$_SESSION
?