现在我的所有网页都不再正确格式化,因为它不再是一个inc文件。如何让php网页在另一个php文件中读取并应用格式?
最初我只是用这个
<?php
readfile("balls.inc");
?>
</head>
<body>
<!--#include virtual="balls.inc"-->
但是当然现在这已经不再有效了,因为导航现在是一个php文件,有关如何获得相同结果的任何建议吗?
答案 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";
?>