で作業していない:リダイレクトは、私は次のPHPスクリプトを提出し、フォームボタンのクリック時に起動してきた様々な方法
<?php
//header('Location: video_download.html');
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["logo"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
$new_name = 'logo'.'.'.$imageFileType;
$target_file = $target_dir . $new_name;
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["logo"]["tmp_name"]);
if($check == false) {
echo "File is not an image.\n";
$uploadOk = 0;
}
}
// Check file size
if ($_FILES["logo"]["size"] > 5000000) {
echo "Sorry, your file is too large.\n";
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "png") {
echo "Sorry, only PNG files are allowed.\n";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.\n";
if (file_exists("config.txt")) {
unlink("config.txt");
}
if (file_exists("upload/logo.png")) {
unlink("upload/logo.png");
}
// if everything is ok, try to upload file & create config.txt
} else {
if (move_uploaded_file($_FILES["logo"]["tmp_name"], $target_file)) {
$template = $_POST['template'] . "\n";
$club = $_POST['club'] . "\n";
$stats = $_POST['stats'];
if (file_exists("config.txt")) {
unlink("config.txt");
}
file_put_contents("config.txt", $template . $club . $stats);
echo '<meta http-equiv="Refresh" content="0; url=video_download.html">';
shell_exec("./blender_lite/bin/blender -b -P blender.py");
exit();
} else {
echo "There was an error uploading your file.\n";
exit();
}
}
?>
は、私はそれがすべてのスクリプトの内容を実行した後、別のHTMLページにブラウザをリダイレクトします。私は2つの異なるアプローチを試みました:ヘッダー(上記のコードでコメント)とリダイレクトでHTMLメタタグをエコーします。
どちらも不明な理由で動作しません。私はそれを見つけることができません(他の方法を見つけて問題を解決するために何時間も過ぎましたので、私はPHPスクリプト)。任意のヘルプは歓迎、ありがとう:)
残念ですが、ヘッダーの直後のexit関数では、残りのスクリプトは実行されないため、これは関係ありません。貢献してくれてありがとう、もっと良い解決策があれば教えてください:) –