php - 动态标题

php - dymanic title

如何设置动态标题? 这是我的 header 文件,我想在其中动态设置标题。

<!DOCTYPE html><html lang="en"><head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php $title ?></title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/custom.css">
</head>
<body>

我要发送标题的文件

<?php
include "layout/header.php"; 
include "layout/footer.php";
$title = "my title";
?>

在包含 header 文件之前定义标题。

$title = "my title";
include "layout/header.php"; 
include "layout/footer.php";
?>