我尝试了不止一次,但每次都会出现同样的错误。
mysql --user="root" --password="rootpass" -e "GRANT ALL PRIVILEGES ON *.* TO 'snap' with grant option;"
功能
Fatal error: Out of memory (allocated 507510784) (tried to allocate 16384 bytes) in ..(location)..\accounts.php on line 51
这就是我所说的。
public function getUser($userBase, $allowID = true, $allowUName = true, $allowEmail = true, $allowHash = true) {
// If nothing allowed!
if ($allowID == false && $allowUName == false && $allowEmail == false && $allowHash == false) {
return NULL;
}
if ( $allowID == true ) {
// User ID
$result = $this->conn->query( "SELECT * FROM `accounts` WHERE `id` = {$userBase}" );
if ( $result && $result->num_rows > 0 ) {
return new user( $this->conn, $userBase );
}
}
if ( $allowUName == true ) {
// User Name
$result = $this->conn->query( "SELECT * FROM `accounts` WHERE `username` = '{$userBase}'" );
if ( $result && $result->num_rows > 0 ) {
return new user( $this->conn, $userBase );
}
}
if ( $allowEmail == true ) {
// Email
$result = $this->conn->query( "SELECT * FROM `accounts` WHERE `email` = '{$userBase}'" );
if ( $result && $result->num_rows > 0 ) {
return new user( $this->conn, $userBase );
}
}
if ( $allowHash == true ) {
$result = $this->conn->query( "SELECT * FROM `accounts` WHERE `hash` = '{$userBase}'" );
if ( $result && $result->num_rows > 0 ) {
return new user( $this->conn, $userBase );
}
}
return NULL;
}
我不知道它使用这个巨大内存的原因。
答案 0 :(得分:0)
到目前为止,我理解了这个问题
包含连接到数据库并再次加载它的新用户的行,导致无限循环尝试达到结果然后失败!