基础问题在php中可以使用include ("head.html")吗? 本人刚学习php,属于菜鸟,希望能够得到帮助。我想把我网页头部head和foot,都做成单独的页面,然后在index.php页面中包含就head和foot。使用include ("head.html");语句可以吗?如果不行,有什么好的建议吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不可以,只能include php文件,但是你可以将head.html头部添加<?php ?>空语句,然后将文件保存为php文件。 何不试试?呢这是可以的如果.html里,有php代码,请在apache的配置文件里AddType application/x-httpd-php 后面加上 .html意思就是.html后缀的,作为php文件来解析。 你这样,不会影响html正常的解析? 他说的是把html当作php解析 和lz的问题没有关系 不解析也是可以include的 貌似不影响解析的AddType application/x-httpd-php 后面加上 .html这样做的目的是,,,如果有人访问file.html,不至于把代码泄露 我加上这就话了,AddType application/x-httpd-php 后面加上 .html可是还是在php页面不能显示html中的内容啊。 麻烦,代码格式,,贴出html文件内容看看 在PHP里可以indclude('head.html');但不能从html里include('head.php'); head.html代码<?php<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title></title> <link rel="stylesheet" type="text/css" href="/computer/css/index.css" /> <script type="text/javascript" src="/computer/lib/jquery.js"></script> <script language="javascript" src="/computer/lib/trimpath.js"></script> </head> <body> <div class="index_container"> <div class="index_head_container"> <div class="index_head_image_container"> <a href="/computer/index.html"><img src="/computer/images/logo.gif"></img></a> </div> <div class="index_head_content_container"> <ul> <li id="index_content_showtime"></li> <li>推荐分辨率1024 × 768</li> </ul> </div> </div> <!--隐藏的top信息数据模板层--> <div id="index_template_info_top_container" style="display:none"> <embed class="index_head_flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="/computer/flash/${info.top_flash}" type="application/x-shockwave-flash" wmode="transparent" quality="high"></embed> </div> <!--top信息目标输出层--> <div id="index_top_flash_container"></div> </div> </body></html>?><script src="/computer/javascript/head.js"></script>index.php代码<?php include("head.php");?>但是head.html中内容不能显示出来啊? 如果include "*.*",是把*.*里的数据插入到当前程序。如果*.*是PHP脚本,会被解析,如果不是,则原文显示。 不管是什么后缀名的文件,php都可以include进来,其中的<?php ?>部分会被解析。其他的部分保持原来的样子输出。。 服了既然文件名是.html<?php include("head.php");//文件名总要一致吧??????>如果是纯粹的html文件,,在这个html文件里,就没必要<?php ?>等格式如果是需要解析的php文件,最好保存为.php吧 memcache connect 请问在mysql中的映射是怎么回事啊 求投票系统制作方法 zend studio 7.1的ftp链接问题[高分在线等] 请教数据刷新 自动滚屏问题? PHP下载的问题,请高手指教~ discuz 6.0.0 后台无法登陆怎么解决? 连接mysql问题 谁有 FCKEditor 的使用手册?我想看看如何使用?我不晓得我的方法对不?(代码内详) 请问有没有人知道有没有PHP文件转换成ASP文件的转换工具呢(手工除外) 求一个算法 谁会asp转php谢谢
AddType application/x-httpd-php 后面加上 .html意思就是.html后缀的,作为php文件来解析。
貌似不影响解析的AddType application/x-httpd-php 后面加上 .html这样做的目的是,,,如果有人访问file.html,不至于把代码泄露
可是还是在php页面不能显示html中的内容啊。
但不能从html里include('head.php');
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title> <link rel="stylesheet" type="text/css" href="/computer/css/index.css" /> <script type="text/javascript" src="/computer/lib/jquery.js"></script>
<script language="javascript" src="/computer/lib/trimpath.js"></script>
</head> <body>
<div class="index_container"> <div class="index_head_container"> <div class="index_head_image_container">
<a href="/computer/index.html"><img src="/computer/images/logo.gif"></img></a>
</div> <div class="index_head_content_container"> <ul>
<li id="index_content_showtime"></li>
<li>推荐分辨率1024 × 768</li>
</ul> </div> </div> <!--隐藏的top信息数据模板层-->
<div id="index_template_info_top_container" style="display:none"> <embed class="index_head_flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="/computer/flash/${info.top_flash}" type="application/x-shockwave-flash" wmode="transparent" quality="high"></embed> </div> <!--top信息目标输出层-->
<div id="index_top_flash_container"></div>
</div> </body></html>
?>
<script src="/computer/javascript/head.js"></script>index.php代码<?php
include("head.php");
?>但是head.html中内容不能显示出来啊?
如果*.*是PHP脚本,会被解析,如果不是,则原文显示。
include("head.php");//文件名总要一致吧?????
?>如果是纯粹的html文件,,在这个html文件里,就没必要<?php ?>等格式如果是需要解析的php文件,最好保存为.php吧