是否可以通过PHP包含在HTML上添加CDN?

是否可以通过PHP包含在HTML上添加CDN?,php,html,bootstrap-4,cdn,Php,Html,Bootstrap 4,Cdn,我正在为家庭作业创建一个网站,它将有多个页面。我使用的是Bootstrap4,对于每个页面,我必须在HTML的头部声明很多链接和脚本 我的问题是,是否可以通过HTML或PHP include添加一个链接,这样我就可以使用一行代码来添加所有内容,并在一个文件中编辑所有内容 这就是我所拥有的 <head> <title></title> <meta charset="UTF-8"> <meta name="viewport

我正在为家庭作业创建一个网站,它将有多个页面。我使用的是Bootstrap4,对于每个页面,我必须在HTML的头部声明很多链接和脚本

我的问题是,是否可以通过HTML或PHP include添加一个链接,这样我就可以使用一行代码来添加所有内容,并在一个文件中编辑所有内容

这就是我所拥有的

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="stylesheet.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
        integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
        crossorigin="anonymous"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>

我想要这样的东西

<head>
    <title> </title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="alltheotherlinksandscripts.php">
</head>
<html>
<head>
    <title></title>
    <?php
        include_once "alllinks.php";
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body> </body>
</html>

或此

<head>
    <title> </title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="alltheotherlinksandscripts.php">
</head>
<html>
<head>
    <title></title>
    <?php
        include_once "alllinks.php";
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body> </body>
</html>


你可以。将标题放在一个单独的php文件中,您可以将其包含在所有文件中

<head>
 <?php include('header.php'); ?>
</head>

是的,您可以在一个文件中设置所有链接(js/css库),即
alllinks.php

并在
部分中调用该文件,如

<head>
    <?php include('alllinks.php'); ?>
</head>