如何从其他PHP文件运行PHP文件?

如何从其他PHP文件运行PHP文件?,php,html,containers,Php,Html,Containers,我有一个PHP文件,它本身可以正常工作,但我需要它在我的主页的某个部分file.PHP上运行 我希望myfile.php在file.php内部运行,我将容器正确地划分到需要它的位置,并尝试使用它,但我希望它自动调整大小 假设myfile.php有一个宽度为900px的表,但当我打开file.php时,myfile.php中的表大小变小了。尺寸变为900px以下。如何使myfile.php中的表仍为900px,而在file.php中使用div容器运行该表?在file.php中 包括“path/to

我有一个PHP文件,它本身可以正常工作,但我需要它在我的主页的某个部分file.PHP上运行

我希望myfile.php在file.php内部运行,我将容器正确地划分到需要它的位置,并尝试使用
它,但我希望它自动调整大小


假设myfile.php有一个宽度为900px的表,但当我打开file.php时,myfile.php中的表大小变小了。尺寸变为900px以下。如何使myfile.php中的表仍为900px,而在file.php中使用div容器运行该表?

在file.php中

包括“path/to/myfile.php”

您可以使用php“包含”


顺便说一句,你想用大小做什么,我相信你需要的是CSS,而不是php

也许是这样

myfile.php

<table style="width:900px">
<tr><td></td></tr>
</table>

此代码使用div index3.php

<!DOCTYPE html
   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JS Change Class</title>
<script language="JavaScript" src="js/adspreview.js"type="text/javascript" xml:space="preserve"></script>

<div id="container">
        <td><?php include("test.php"); ?>
</div>
</html>

JS变更类
这里是我想在index3.php中运行的代码

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test</title>
</head>

<body>

<table border="1" width="100%">
    <tr>
        <td bgcolor="#0000FF" colspan="2">
        <p align="center"><font color="#FFFFFF" face="Arial"><b>Test</b></font></td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
</table>

</body>

</html>
<!DOCTYPE html
   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JS Change Class</title>
<script language="JavaScript" src="js/adspreview.js"type="text/javascript" xml:space="preserve"></script>
</head>
<body>
<div id="container">
        <?php include("test.php"); ?>
</div>
</body>
</html>

试验

测试

请试一试,我对此感到困惑。谢谢您的帮助。

首先: index3.php

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test</title>
</head>

<body>

<table border="1" width="100%">
    <tr>
        <td bgcolor="#0000FF" colspan="2">
        <p align="center"><font color="#FFFFFF" face="Arial"><b>Test</b></font></td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
</table>

</body>

</html>
<!DOCTYPE html
   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JS Change Class</title>
<script language="JavaScript" src="js/adspreview.js"type="text/javascript" xml:space="preserve"></script>
</head>
<body>
<div id="container">
        <?php include("test.php"); ?>
</div>
</body>
</html>

JS变更类
第二: teste.php

<table border="1" width="100%">
    <tr>
    <td bgcolor="#0000FF" colspan="2">
        <p align="center"><font color="#FFFFFF" face="Arial"><b>Test</b></font>
    </td>
    </tr>
    <tr>
        <td>&nbsp;</td>
    </tr>
</table>

测试


CTRL+C+CTRL+V^

你说的是。。。一个
包含
<代码>iframe
div
style
overlay
?@Welly:
请显示您的代码