且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将HTML \ PHP页面加载到另一个页面的div中

更新时间:2023-02-26 12:52:36

you can use the include functions (require(), require_once() functions would work as well), like this:

(change links.html to links.php)

<html>
<body>
    <div id="links" class="myCustom1">
    <?php include("links.php"); ?>
    </div>

    <div id="contents" class="myCustom2">
    <?php include("contents.php"); ?>
    </div>
</body>
<html>

I set it to links.html which is your filename but if it's in a subdirectory you need to specify it as well.

eg:

include("subfolder/links.html");