1
我正在尝试使用PHP创建网站。对于我的头文件代码,我在includes/header.php文件中包含所有头文件代码。因此,每个页面开始与如何从PHP标签以外设置变量
<?php
include("includes/header.php");
?>
这工作,但我需要一些定制,所以如果我需要JS什么的仅添加到第1页。这就是我的目标为:
<?php
$header_code =
?>
Hi there, this is some code that can be used with a echo $header_code in the includes/header.php file.
<?php
; //end of the header_code variable
?>
<?php
include("includes/header.php");
?>
比在header.php
文件有回音$header_code
,而不是:
<?php $header_code = "This is some header code..."; ?>
因为可能有大量的代码在这里。
感谢提前:)