当我想要添加任何新的CSS文件或任何新的JS文件时,我把它放在标题中
css文件
<link rel="stylesheet" href="<?PHP echo URL; ?>public/css/header.css" /> <link rel="stylesheet" href="<?PHP echo URL; ?>public/css/index.css" /> <link rel="stylesheet" href="<?PHP echo URL; ?>public/css/footer.css" /> <link rel="stylesheet" href="<?PHP echo URL; ?>public/css/signup.css" /> <link rel="stylesheet" href="<?PHP echo URL; ?>public/css/contactUs.css" /> <link rel="stylesheet" href="<?PHP echo URL; ?>public/css/option.css" /> <link rel="stylesheet" href="<?PHP echo URL; ?>public/css/question.css" /> <link rel="stylesheet" href="<?PHP echo URL; ?>public/css/profile.css" />
js文件
<script src=<?PHP echo URL . "public/Js/profile.js" ?>></script> <script src=<?PHP echo URL . "public/Js/cell.js" ?>></script> <script src=<?PHP echo URL . "public/Js/place.js" ?>></script> <script src=<?PHP echo URL . "public/Js/ontology.js" ?>></script> <script src=<?PHP echo URL . "public/Js/informativeObject.js" ?>></script> <script src=<?PHP echo URL . "public/Js/question.js" ?>></script>
我想要的东西
<header> include all css include all js </header>
解决方法
我认为stackoverflow上的这个帖子完全可以回答你的问题:
How to include all css kept in a direcotry?
(我不认为它是有用的,我复制/粘贴,所以只是检查它)
UPDATE —–
它有点复杂,但它也在stackoverflow以及!
How do I include a JavaScript file in another JavaScript file?