douchen2595 2015-06-21 09:44
浏览 232
已采纳

html提取页眉和页脚来分隔文档

I have several html documents which share the same header and footer and would like to extract header and footer to separate html files and include them to other html documents.

The idea is very simple: when I change something in header, the change has to be made on all pages.

Until now I used PHP include function. But I have read some articles that this has impact on performance.

What is the best way to do this for clean html pages ?

Is the PHP the way to go ?

If it is, should I insert the whole html content into PHP echo ?

  • 写回答

2条回答 默认 最新

  • douliang6563 2015-06-21 10:02
    关注

    There isn't really a good way doing it in pure HTML, since iframe or an ajax-request using Javascript wouldn't be a good solution here.

    I would say the best way is to use the PHP include or PHP require-function:

    http://php.net/manual/en/function.include.php http://php.net/manual/en/function.require.php

    You won't see any performance issues. Remember that include is a little bit faster than include_once, since include_once will have to make an extra check if the file has already been included.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作