如何使用 PHP 代码而不是 HTML 代码导入/包含 CSS 文件? [英] How to import/include a CSS file using PHP code and not HTML code?

查看:22
本文介绍了如何使用 PHP 代码而不是 HTML 代码导入/包含 CSS 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在谷歌上搜索了很多,但似乎我做错了什么.

I have googled a lot but it seems that I am doing something wrong.

我想这样做:

<?php
include 'header.php';
include'CSS/main.css';
...
?>

但是,我的页面打印了 CSS 代码.

However, my page prints the CSS code.

注意:我想使用 PHP 来包含 CSS 文件,而不是使用我还想将我的 CSS 文件重命名为某些网站提到的 PHP 文件.

Note: I want to use PHP to include the CSS file, and not use I also do you want to rename my CSS file to a PHP file as some website mentioned.

有什么线索吗?

非常感谢.

推荐答案

你必须用