-6

PHP コンタクトフォームにエラーがあります

   if ($sukces){
      print "<meta http-equiv="\" refresh\""="" content="\" 0;url="potwierdzenie.php\""">";
      }
    else {
       print "<meta http-equiv="\" refresh\""="" content="\" 0;url="error.htm\""">";
}
?>

私はそれが\べきものであることを知っています/しかし、どこにあるのかわかりません。手伝ってくれてありがとう。

4

2 に答える 2

3

いくつかのオプションがあります:

1) 次のようにエスケープします。

echo "<meta http-equiv=\"Refresh\" CONTENT=\"0\"; URL=\"potwierdzenie.php\">";

2) HTML に埋め込まれた if-else 構文を使用します。

<?php if ($sukces): ?>

<meta http-equiv="Refresh" CONTENT="0" URL="potwierdzenie.php">
<?php else:   ?>    
<meta http-equiv="Refresh" CONTENT="0" URL="error.htm">
<?php endif; ?>

それ以外の場合は、html 内に埋め込む

3) @"Nick L." のように、二重引用符内で単一引用符を使用します。言った

4)これを行います:

< meta http-equiv="Refresh" CONTENT="0" URL="< ?= ($sukces ? "potwierdzenie.php" : "error.htm" ) ? >">

于 2014-12-19T23:37:57.703 に答える
1

この混乱を避ける良い方法は、一重引用符を使用することです (コメントに記載されているように、Michael Berkowski のコメントに敬意を表します)。

<?php

if ($sukces){
      print "<meta http-equiv='refresh' content='0' url='potwierdzenie.php'>";
} else {
       print "<meta http-equiv=' refresh' content='0'url='error.htm'>";
}

?>
于 2014-12-19T23:52:38.710 に答える