PHP禁用HTML

时间:2014-08-07 08:51:36

标签: php html

我遇到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信息日志:

http://www.surf4you.ch/help/logfile.php

3 个答案:

答案 0 :(得分:0)

你可以给我们更多的信息吗?

对于ie,尝试创建一个phpinfo.php文件 而且里面只放

<?php print(phpinfo()); ?>

这似乎是服务器没有正确的配置和PHP不起作用。查看服务器的日志

答案 1 :(得分:0)

我认为您的html代码之前有这样的版本,现在您已经更改了它并且在浏览器中使用了缓存,尝试使用其他浏览器。或者您的PHP配置不正确。使用此命令<?php print(phpinfo()); ?>

向我们提供php信息

答案 2 :(得分:0)

您也可以回显所有HTML代码,但这真的很糟糕。 更好地联系服务器管理员。你的代码没问题。 你能告诉我们你的phpinfo(); ?