Rumah >pembangunan bahagian belakang >tutorial php > PHP 登陆验证时代码有有关问题
PHP 登陆验证时代码有问题
用户名和账号储存在txt文本上,就是密码验证不了,我试过用户名单独验证能成功,不知道哪里错了。。
$Logi = file ( "users.txt" );
$size = sizeof ( $Logi );
foreach( $Logi as $Key => $Val )
{ $Data [ $Key ] = explode ( "|" , $Val ); }
for( $K = 0 ; $K
{
$user = $Data [ $K ][ 0 ];
$pass = $Data [ $K ][ 1 ];
if($user==$_POST[ "user" ]&&$pass==$_POST[ "pass" ])
{
echo "success";
}
else echo "No";
}