如何获取PHP文件与inc文件做同样的事情?

时间:2017-02-26 07:48:20

标签: php html xhtml ssi

现在我的所有网页都不再正确格式化,因为它不再是一个inc文件。如何让php网页在另一个php文件中读取并应用格式?

最初我只是用这个

<?php
readfile("balls.inc");
?>
</head>

<body>
<!--#include virtual="balls.inc"-->

但是当然现在这已经不再有效了,因为导航现在是一个php文件,有关如何获得相同结果的任何建议吗?

1 个答案:

答案 0 :(得分:2)

在PHP中您可以使用include或include_once或require

include 'your_file.php';  // include each time you use the call  

http://php.net/manual/it/function.include.php

include_once 'your_file.php';  // include just one time you use the call  

http://php.net/manual/en/function.include-once.php

 require 'your_file.php';  // stop execution if not find

http://php.net/manual/en/function.require.php

在你的情况下

<?php
 include "navigation.php";
 ?>