Php 变量自动预结束文件?

Php 变量自动预结束文件?,php,Php,好吧,我的题目很烂XD如果有人有更好的题目,请编辑 无论如何,我的php.ini文件中有以下内容: auto_prepend_file = ./include/startup.php auto_append_file = ./include/shutdown.php startup.php如下所示: <?php chdir(__DIR__."/.."); require("include/db.php"); // more setup stuff here if( $_SERVER['R

好吧,我的题目很烂XD如果有人有更好的题目,请编辑

无论如何,我的php.ini文件中有以下内容:

auto_prepend_file = ./include/startup.php
auto_append_file = ./include/shutdown.php
startup.php如下所示:

<?php
chdir(__DIR__."/..");
require("include/db.php");
// more setup stuff here
if( $_SERVER['REQUEST_METHOD'] == "AJAX") { // yup, custom HTTP method :p
    // parse file_get_contents("php://input")
}
else {
    $output_footer = true;
    require("include/header.php");
}
<?php
if( isset($output_footer)) require("include/footer.php");

显然,这并不理想!当所述标题作为自动预结束文件输出时,有没有关于如何调整标题的建议?

我认为您不应该像那样使用附加和预结束功能,但这只是我的意见

为什么不创建
header.php
以允许可变标题文本。并完全删除前置和附加脚本

<title><?php echo (isset($title)) ? $title : 'default title'; ?></title>

为什么要使用
auto\u prepend\u文件
?尤其是当你对动态内容有意见时?(本指令设计为静态指令)
<title><?php echo (isset($title)) ? $title : 'default title'; ?></title>
$title = "some title";
require("include/header.php");