第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

PHP 不與 arraypart 進(jìn)行比較

PHP 不與 arraypart 進(jìn)行比較

PHP
POPMUISE 2022-12-11 10:41:13
我正在創(chuàng)建一個(gè)簡單的腳本,它在文本文件中搜索正確的組合,但它不起作用。我對(duì)所有問題都進(jìn)行了故障排除,但所有部分都可以正常工作,但整個(gè)腳本仍然無法正常工作,我不知道如何修復(fù)它。代碼:<html><form><input type="text" name="input" placeholder="hash"><button type="submit">Crack!</button></form><?php$input = $_GET["input"]; // pulling input from url$hashes = file_get_contents("hashes.txt"); // loading hashes$hasharray = explode(";", $hashes); // separating hashcombos$arraynum = count($hasharray); // counting number of hashcombos// defining loop$loopnum = 0;while($loopnum < $arraynum) {    $combo = $hasharray[$loopnum]; // selecting hashcombo    $comboarray = explode("|", $combo); // separating hashcombo    $text = $comboarray[0];    $hash = $comboarray[1];    // cecking if hash matches    if($hash === $input) {        echo("Hash: $hash");        echo("<br>");        echo("Text: $text");    }    $loopnum = $loopnum + 1; // updating loop}?></html>示例 hashes.txt:test|example;example|test;
查看完整描述

1 回答

?
揚(yáng)帆大魚

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超9個(gè)贊

您的文件包含換行符,它們也是不可見的字符。例如:

test|example;(newline here)
example|test;

您使用 拆分文件中的行;,但這不會(huì)刪除換行符??紤]到您問題中的評(píng)論,您的結(jié)果中有換行符導(dǎo)致比較失敗。也就是說,我建議在加載哈希以刪除換行符后立即使用以下解決方案:

$hashes = preg_replace("/[\r\n]/", "", $hashes);

這將產(chǎn)生如下字符串:

test|example;example|test;

您的其余代碼將按預(yù)期工作。


查看完整回答
反對(duì) 回復(fù) 2022-12-11
  • 1 回答
  • 0 關(guān)注
  • 108 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)