1
私はHTMLフォームからURLをリクエストしてPHPに送り、ifファイルexsistsを実行してからjqueryを返しますif ifそのファイルはレポートメッセージを無効にします。PHPを使用して他のサーバに外部ファイルが存在するかどうかを調べる
以下のコードを見てください。唯一の問題は、実際にページが応答されたことを知ることができず、PHPのfile_exsistsコマンドに問題があると考えていることです。
<?php
header('Access-Control-Allow-Origin: *');
$filename = $_POST["find-one"];
$filename2 = $_POST["find-two"];
?>
<html>
<header>
<title>404 Tool</title>
<script type="text/javascript" src=".../1.7.1/jquery.min.js"></script>
<?php
if (file_exists($filename)) {
echo "<script>
$(document).ready(function() {
$('.report-one').text('File $filename is found.');
});
</script>";
} else {
echo "<script>
$(document).ready(function() {
$('.report-one').text('File $filename doesn't exsist.');
});
</script>";
}
if (file_exists($filename)) {
echo "<script>
$(document).ready(function() {
$('.report-two').text('File $filename2 is found.');
});
</script>";
} else {
echo "<script>
$(document).ready(function() {
$('.report-two').text('File $filename2 doesn't exsist.');
});
</script>";
}
?>
</header>
<form method="post" action="<?php echo $PHP_SELF;?>">
<input type="text" name="find-one" class="find-one"/>
<p class="report-one">Waiting</p>
<input type="text" name="find-two" class="find-one"/>
<p class="report-two">Waiting</p>
<input type="submit" value="Search for 404's">
</form>
</body>
</html>