我有一个问题与HTML和PHP只要我将PHP代码添加到PHP文件中,HTML代码就会消失。这很难解释。例如:
<html>
<head>
<title>Example</title>
</head>
<body>
<span> Hello </span>
<?php
echo 'Hi';
?>
<span>Hey</span>
</body>
</html>
它只显示Hello,但是Hi和Hey消失了。当我在本地尝试一切都工作时,这个问题一上传到服务器就出现了。
当我按ctrl + U在我的索引站点,它显示如下:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="description" content="Schweizer Quiz"/>
<meta name="author" content="Jan Ritzl"/>
<meta name="Six" content="Quiz"/>
<meta http-equiv="X-UA-Compatible" content="IE=10"/>
<link rel="stylesheet" type="text/css" href="./style/style.css"/>
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"/>
<script src="./js/jquery-1.11.1.min.js"></script>
<script src="./js/jquery.fullBG.js"></script>
<title>Quiz Schweiz</title>
</head>
<body>
<img id="background" src="./img/stadt.jpg" style="visibility: hidden" id="background" />
<script>
$(window).load( function() {
$( '#background' ).fullBG();
} );
</script>
<div id="userdaten">
<a href="./login.php"><img src="./img/six.png" id="logo"/></a>
<h2>Allgemeinwissen Schweiz</h2>
<h4>Füllen Sie diese 30 Fragen so gut aus wie nur möglich!<br/>Falls Sie auf eine Frage keine Antwort wissen, schreiben Sie einen "-"</h4>
<form action="save.php" METHOD="POST">
<label for="Name"><span>Name</span></label><input id="Name" name="Name" class="form" type="text" required />
<label for="Vorname"><span>Vorname</span></label><input id="Vorname" name="Vorname" class="form" type="text" required />
</div>
<div id="fragendiv">
<label for="f1"><span>1. Wie viele Bundesräte hat die Schweiz?</span></label><input id="f1" name="f1" class="frage" size="100" type="number" required />
<label for="f2"><span>2. Wie heissen diese Bundesräte?</span></label><input id="f2" name="f2" class="frage" size="100" type="text" required />
<label for="f3"><span>3. Wie heisst der bekannteste Schweizer Berg?</span></label><input id="f3" name="f3" class="frage" size="100" type="text" required />
<label for="f4"><span>4. Wie heisst die bekannteste Luzerner Brücke?</span></label><input id="f4" name="f4" class="frage" size="100" type="text" required />
<label for="f5"><span>5. Wann feiert die Schweiz jeweils ihr Jubiläum?</span></label><input id="f5" name="f5" class="frage" size="100" type="text" required />
<label for="f6"><span>6. Wie viele Kantone hat die Schweiz?</span></label><input id="f6" name="f6" class="frage" size="100" type="number" required />
代码停止一旦我使用PHP…有人能帮我吗?
PHP Info日志:
http://www.surf4you.ch/help/logfile.php你能给我们更多的信息吗?
对于ie,尝试创建一个phpinfo.php文件里面只放
<?php print(phpinfo()); ?>
似乎服务器没有正确的配置和php不工作。查看服务器的日志
我认为你的html代码之前像这样,现在你改变了它,它已经使缓存在你的浏览器尝试使用另一个浏览器。或者你的PHP配置不正确。使用<?php print(phpinfo()); ?>
你也可以回显所有的HTML代码,但这真的很糟糕。最好联系服务器管理员。你的代码没问题。你能告诉我们你的phpinfo();div ?