例如,我已經叫'include.php'或'include.html'一個頁面,其中包含下面的代碼行: <h1>Hi {$yourname}, this is a header.</h1>
現在,我想包括使用另一頁上PHP這個頁面,讓我們'index.php'說使用: <?
$yourname = 'Bir';
include 'include.php';
?>
當我包括它,頁面顯示
我有一些代碼在我的服務器上工作,當我把它放到不同的服務器(包括CentOS,Apache)時,包含文件不會執行代碼。所以,我得到如下: 主文件 <div>
<?php
//This does include it, but as though it were text
include("/var/www/mypath/file.php");
?>
</di