txtファイルの内容がユーザーの入力と同じかどうかを確認するためにphpスクリプトを作成しました。それが正しいかどうか、そしてそれがelseに送信されていないかどうかを確認するためにifステートメントを書きました。変数を送信しない場合、機能し、表示されます
a is b is file is 1
しかし、ファイルと正しい内容を入力すると表示されます
a is test.txt b is hello file is hello 0
これが私のコードです
<?php
session_destroy();
$a=htmlspecialchars($_REQUEST['a']);
$b=htmlspecialchars($_REQUEST['b']);
$my_file = file_get_contents($a);
echo "a is $a\n";
echo "b is $b\n";
echo "file is $my_file\n";
if ( $my_file == $b ) {
echo "1";
}else {
echo "0";
}
?>
何か案は?