How to load header and footer .html dynamicaly

霸气de小男生 提交于 2019-12-10 11:34:21

问题


I am trying to include a header and footer dynamically with an url like this:

<?php include("http://www.monsite.com/layout/header.html"); ?>

but it doesn't work.

Anybody can help me ?

Thanks you.


回答1:


include() expects a physical path on the file server, not a URL.

Files are included based on the file path given or, if none is given, the include_path specified. If the file isn't found in the include_path, include will finally check in the calling script's own directory and the current working directory before failing.

<?php include("/root/path/to/layout/header.html"); ?>



回答2:


Make sure that the path you added in include function is correct.I think you are doing mistake in path of header file.

<?php include("root/path/layout/header.html"); ?>


来源:https://stackoverflow.com/questions/28551552/how-to-load-header-and-footer-html-dynamicaly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!