扫码关注官方订阅号
页面动静分离,想提取头部和底部这类公共部分,加载到各个页面,方便只改一个地方就可以了,请问大家如何提取,不用iframe或把html写在js里再引用
小伙看你根骨奇佳,潜力无限,来学PHP伐。
以header为例:在header.html中写一些你页面header需要的东西。header.html:
<p>header</p>
index.html:
<header id="header"></header> <p>页面内容</p> <script> $("#header").load("header.html", function() { });//在index.html中引入header </script>
学学smarty {inlcude file='abc.htm'},这样只要abc.htm就行了
$.load();
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
以header为例:
在header.html中写一些你页面header需要的东西。
header.html:
index.html:
学学smarty {inlcude file='abc.htm'},这样只要abc.htm就行了
$.load();