例如,我有一个名为'include.php'
or的页面'include.html'
,其中包含以下代码行:
<h1>Hi {$yourname}, this is a header.</h1>
现在,我想在另一个页面上使用 PHP 包含这个页面,假设'index.php'
使用:
<?
$yourname = 'Bir';
include 'include.php';
?>
当我包含它时,页面显示:
<h1>Hi {$yourname}, this is a header.</h1>
变量$yourname不会被它的 value 替换"Bir"
。
我该如何解决这个问题?