PHP数组不起作用 [英] Php array not working
本文介绍了PHP数组不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
最好的开始方法是使用我的代码:
The best way to start is with my code:
$passwords = file_get_contents('87941192.php');
$passwords_array = array($passwords);
if((array_key_exists($_POST['uname'], $passwords_array))
and
($passwords_array[$_POST['uname']] == $_POST['pass'])){
$_SESSION['user'] = $u;
$_SESSION['logged'] = "yes";
echo "Login Successful, You can now access your profile <br /> You can also make transactions now.";
}else{
print "username or pass was incorrect";
}
发生的是它从文本文件获取密码和用户名.我没有使用数据库,因为我只是在测试数据库,目前没有必要.密码的格式为:
What happens is it gets passwords and usernames from a text file. Im not using a database as im only testing it, and there is no need at the moment. the passwords are in the format:
''username'' => ''password''
,''username1'' => ''password1''
每次检查用户名和密码是否正确时,它都会转为负数.
为什么会这样?
Every time it checks if the username and password are correct it turns back negative.
Why is this?
推荐答案
密码 = file_get_contents('
passwords = file_get_contents('87941192.php');
passwords_array = array(
passwords_array = array(
passwords); if((array_key_exists(
passwords); if((array_key_exists(
这篇关于PHP数组不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文