我的代碼:數組的in_array()不工作
<?php
$pass = "12345";
//checkPass($pass, $user, $length);
$file = file_get_contents("common.txt");
$array = explode("\n", $file);
if(in_array($pass, $array) == true) {
echo "it's in the array";
}
?>
前幾行(我用的print_r($陣列)...):
Array ([0] => 12345 [1] => abc123 [2] => password [3] => computer [4] => 123456 [5] => tigger [6] => 1234 [7] => a1b2c3 [8] => qwerty [9] => 123 [10] => xxx [11] => money [12] => test [13] => carmen [14] => mickey [15] => secret [16] => summer [17] => internet [18] => service [19] => canada [20] => hello [21] => ranger [22] => shadow [23] => baseball [24] => donald [25] => harley [26] => hockey [27] => letmein [28] => maggie [29] => mike [30] => mustang [31] => snoopy
你能後,您可以設置$傳遞等於它的價值的時候:你可以使用爆炸與
array_map()
的trim()
後陣擺脫這些字符? –它位於文件的頂部,緊跟在開始的PHP標記之後。我試着在上面編輯它,但有些東西不能正常工作。 – Andrew