我正在创建我的登录页面,当我加载它时,我似乎收到了这个错误消息:
致命错误:无法在第 4 行的 /home/a4625512/public_html/core/functions/general.php 中重新声明 email()(之前在 /home/a4625512/public_html/core/functions/general.php:2 中声明)
我的主机是000WebHost所以不知道是不是跟他们有关系,我在网上到处找。
general.php 代码:
function email($to, $subject, $body) {
mail($to, $subject, $body, 'From: hello@points4u.com');
}
登录代码:
include 'core/init.php';
if(empty($_POST) === false){
$username = $_POST['username'];
$password = $_POST['password'];
if(empty($username) === true || empty($password) === true){
$errors[] = 'You need to enter a username and password.';
}else if(user_exists($username) === false){
$errors[] = 'We cant find that username. Have you registered?';
}else if(user_active($username) === false){
$errors[] = 'You have not activated your account!';
}else{
$login = login($username, $password);
if($login === false){
$errors[] = 'That username/password is incorrect.';
}else{
$_SESSION['user_id'] = $login;
header('location: index.php');
exit();
}
}
print_r($errors);
}