当前位置:网站首页>如何实现页面包含
如何实现页面包含
2022-07-25 15:29:00 【Gorgio_Liu】
项目中,习惯把多个页面中完全一样的内容,单独提取出来作为一个独立的文件(如header.html、footer.html),凡是需要此文件的页面,引入该页面即可。页面包含可以采用多种方案:
1、利用Web服务器的SSI命令:客户端请求一个页面,服务器一次返回多个页面 — 需要修改Web服务器配置文件。
2、使用服务器端动态语言提供的页面包含函数:如PHP
include(‘header.php’);
...echo’主体’;
include(‘footer.php’);客户端请求一个页面,服务器返回多个PHP页面组合后的一个页面、
3、在客户端使用AJAX技术:先加载一个页面的主体内容,加载完成后。再去请求header.html、footer.html放到空容器中
<div id=”header”></div>
<main>xxxxxxxx</main>
<div id=”footer”></div>
$.ready(function(){
$(‘#header’).load(‘header.html’);
$(‘#footer’).load(‘footer.html’);
})提示:AngularJS中ng模块提供了一个指令:ngInclude,已经实现了方法3
<div ng-include=” ’tpl/header.html’ “></div>
边栏推荐
- Pytorch学习笔记-Advanced_CNN(Using Inception_Module)实现Mnist数据集分类-(注释及结果)
- ML - 语音 - 传统语音模型
- In depth: micro and macro tasks
- ICPC2021昆明M-暴力+主席树
- GAMES101复习:变换
- 小波变换--dwt2 与wavedec2
- ML - natural language processing - Introduction to natural language processing
- 2019 Shaanxi Provincial race K-variant Dijstra
- Binary complement
- 2016CCPC网络选拔赛C-换根dp好题
猜你喜欢
随机推荐
ML - natural language processing - Introduction to natural language processing
Is it safe to open futures online? Which company has the lowest handling charge?
GAMES101复习:三维变换
苹果内购和Apple Pay 的区别
MySQL transactions and mvcc
看到很多App出现闪烁的图片,特别是会员页面
MySQL heap table_ MySQL memory table heap Usage Summary - Ninth Five Year Plan small pang
Submarine cable detector tss350 (I)
MATLAB 如何生产随机复序列
2021上海市赛-H-二分答案
Pytorch学习笔记--常用函数总结2
matlab 如何保存所有运行后的数据
2021 Shanghai match-h-two point answer
Qtime definition (manual waste utilization is simple and beautiful)
为什么PrepareStatement性能更好更安全?
ML - Speech - advanced speech model
In depth: micro and macro tasks
Deadlock gossip
Seata中jdbc下只有一个lib嘛?
Xcode添加mobileprovision证书文件报错:Xcode encountered an error








