html页面中调用Php页面的方法

View

五年网站建设经验,我们遇到过很多问题,比如如何在Html页面中调用Php页面? 下面我们就介绍一下html页面中调用Php页面的方法:

众所周知Html页面可以调用JS代码或者用iframe标签调用页面,那么我们就用这两种方法实现Html页面中调用Php页面,

Php页面范例:

<?php include(TEMPLATEPATH . '/share.php'); ?>

Html页面调用代码:

JS代码:

<script src="share.php" mce_src="share.php"></script>

iframe代码:

<iframe src="share.php" mce_src="share.php">
</iframe>
<object data="share.php" width="300" height="200">
</object>

iframe代码(无边框):

<iframe src="hello.php" mce_src="hello.php" id="share" scrolling="no" noresize="noresize">
</iframe>

提醒:由于多数template都已固定,因此在处理template和驱动分离的程序时,是个很头疼的问题,而且用iframe对搜索引擎收录也不友好。

因此,我们建议html页面中调用Php页面的最好方法就是使用JS代码调用。