Javascript 将外部jQuery和CSS文件嵌入index.php文件

Javascript 将外部jQuery和CSS文件嵌入index.php文件,javascript,php,jquery,html,css,Javascript,Php,Jquery,Html,Css,我有一个具体的问题。 如何在php文件扩展名中嵌入外部.js或.css文件 它的工作方式与我将其嵌入html文件扩展名的方式不同。您通常会在标记中包含这些内容 <link rel="stylesheet" type="text/css" href="myStyles.css"> <script src="myScript.js"></script> 您还可以使用JQuery通过以下方式获取它: $('#targetThis') then do whateve

我有一个具体的问题。 如何在php文件扩展名中嵌入外部.js或.css文件


它的工作方式与我将其嵌入html文件扩展名的方式不同。

您通常会在
标记中包含这些内容

<link rel="stylesheet" type="text/css" href="myStyles.css">
<script src="myScript.js"></script>
您还可以使用JQuery通过以下方式获取它:

$('#targetThis') then do whatever it is you wanted to do with it...
乙二醇


这不是一个恰当的问题,因为有许多方法可以解释它。请更具体地说明您的实际问题是什么,并提供代码大纲,但如果我只有一个php文件,其中只有php代码。。我有一些回音(文本输出将显示在浏览器上)。如何向其中添加css和jquery?我编辑了答案,以显示针对特定echo的目标。为什么我不能对php使用与html扩展文件类似的技术?您可以只重复整个范围,如
,我只是觉得html和php格式的代码更容易阅读,只是个人喜好而已
<span id:="targetThis">
    <? echo "Text" ?>
</span>
#targetThis {
    color: red;
}
$('#targetThis') then do whatever it is you wanted to do with it...
$('#targetThis').html('Edited Text');