Home > Backend Development > PHP Tutorial > include();引入多个页面怎么交互

include();引入多个页面怎么交互

WBOY
Release: 2016-06-13 10:24:27
Original
1164 people have browsed it

include();引入多个页面如何交互

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phpinclude ("header.html");if("header.html的链接"){    include("indexConntent1.html");}else{    include("indexConntent2.html");}include("footer.html");?>
Copy after login

当本页面是 index.php

问题是这样的 header里面包括一个导航栏 当点击导航栏的时候要根据链接 来引入不同的页面
如何实现
想过一个办法就是 这个页面接受一个来自 header页面的参数 根据那个参数来判断
还有其他更好的办法没?


------解决方案--------------------
探讨

只能这样。不过。当菜单多时。可以考虑用switch 代替 if else

用框架打开多好啊。

------解决方案--------------------
之前做过一个类似的,就是通过smarty,在后台php定义一个变量,assign 到前台去,在前台 switch 这个变量,来包含不同的模板页.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template