PHP代码显示方式与HTML代码不同
我有一个网站,在那里我上传了一个PHP代码显示方式与HTML代码不同,php,jquery,html,Php,Jquery,Html,我有一个网站,在那里我上传了一个index.html,它完全由html代码(没有PHP)组成 我将这段代码复制到一个PHP文件index.PHP,此外,我将头文件分离到一个单独的PHP文件中。当我清理新的index.php时,我只使用了include()来包含标题,如下所示: <? include("TopNote.php"); ?> index.php: <!doctype html> <html lang="us"> <head> <
index.html
,它完全由html代码(没有PHP)组成
我将这段代码复制到一个PHP文件index.PHP
,此外,我将头文件分离到一个单独的PHP文件中。当我清理新的index.php
时,我只使用了include()
来包含标题,如下所示:
<? include("TopNote.php"); ?>
index.php
:
<!doctype html>
<html lang="us">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="web/style.css">
<link href="css/smoothness/jquery-ui-1.10.3.custom.css" rel="stylesheet">
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui-1.10.3.custom.js"></script>
</head>
<body bgcolor="#aaaaaa">
<? include("TopNote.php"); ?>
</body>
</html>
区别是什么,我如何解决它?在
标记中不能有
标记。您的topnote.php
不需要有doctype、head和所有这些东西。因为index.php
已经定义了html、doctype、head、title等等
因此,您的topnote.php
应该只包含以下元素:
<img src="http://destiny-craft.com/img/Logo_Resized.png" alt="" style="padding-left:20px" />
<div align="right" style="padding-right:20px">
<div>
<button id="StaffLogin">Staff Login</button>
<button id="select">Select an action</button>
</div>
<ul>
<li><a href="#">Log Out</a></li>
<li id="buttonregister"><a href="#">Register</a></li>
</ul>
</div>
<form style="margin-top: 1em;">
<div id="menu" align="center">
<input type="radio" id="buttonhome" name="radio" checked="checked"><label for="buttonhome">Home</label>
<input type="radio" id="buttonforums" name="radio"><label for="buttonforums"><a href="http://forums.destiny-craft.com">Forums</a></label>
<input type="radio" id="buttonapply" name="radio"><label for="buttonapply"><a class='fb_iframe' href="http://destiny-craft.coffeecup.com/forms/ApplyForm/">Apply</a></label>
<input type="radio" id="buttonabout" name="radio"><label for="buttonabout">About Us</label>
<input type="radio" id="select" name="radio">
</div>
</form>
<br />
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
<strong>Alert:</strong> The Site Is No Where Near Completed, Please go to our <a href="http://forums.destiny-craft.com/">Forums</a></p>
</div>
</div>
<!-- POP UP -->
<div id="regdialog" title="Register">
<form action="#" method="post">
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
Registrations are not working!</p>
</div>
</div>
<h5>Username:</h5>
<input type="text" name="reg_name">
<h5>Password:</h5>
<input type="password" name="reg_pass">
<h5>Confirm Password:</h5>
<input type="password" name="reg_pass_conf">
<input type="submit">
</form>
</div>
员工登录
选择一个动作
家
关于我们
提醒:该网站尚未完工,请访问我们的网站
注册无效
用户名:
密码:
确认密码:
您可以将
标记移动到topnote.php
的
标记的末尾。将它们放在结束标记之前是有效且更好的做法。这将确保此时加载所有DOM元素。topnote.php
不应包含doctype、html和head,因为您已经在index.php中添加了这些元素
避免使用短标记,如下图所示
<?php include 'file.php'?>
@TiMESPLiNTER谢谢,不仅删除了标签,还删除了标签内的所有东西,这些东西让它工作起来了。
<img src="http://destiny-craft.com/img/Logo_Resized.png" alt="" style="padding-left:20px" />
<div align="right" style="padding-right:20px">
<div>
<button id="StaffLogin">Staff Login</button>
<button id="select">Select an action</button>
</div>
<ul>
<li><a href="#">Log Out</a></li>
<li id="buttonregister"><a href="#">Register</a></li>
</ul>
</div>
<form style="margin-top: 1em;">
<div id="menu" align="center">
<input type="radio" id="buttonhome" name="radio" checked="checked"><label for="buttonhome">Home</label>
<input type="radio" id="buttonforums" name="radio"><label for="buttonforums"><a href="http://forums.destiny-craft.com">Forums</a></label>
<input type="radio" id="buttonapply" name="radio"><label for="buttonapply"><a class='fb_iframe' href="http://destiny-craft.coffeecup.com/forms/ApplyForm/">Apply</a></label>
<input type="radio" id="buttonabout" name="radio"><label for="buttonabout">About Us</label>
<input type="radio" id="select" name="radio">
</div>
</form>
<br />
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
<strong>Alert:</strong> The Site Is No Where Near Completed, Please go to our <a href="http://forums.destiny-craft.com/">Forums</a></p>
</div>
</div>
<!-- POP UP -->
<div id="regdialog" title="Register">
<form action="#" method="post">
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
Registrations are not working!</p>
</div>
</div>
<h5>Username:</h5>
<input type="text" name="reg_name">
<h5>Password:</h5>
<input type="password" name="reg_pass">
<h5>Confirm Password:</h5>
<input type="password" name="reg_pass_conf">
<input type="submit">
</form>
</div>
<?php include 'file.php'?>