gpt4 book ai didi

php - 链接文件(样式表、脚本文件、图像等)

转载 作者:行者123 更新时间:2023-11-28 13:58:38 25 4
gpt4 key购买 nike

我在链接样式表、图像、数据库连接文件 (db.php)、脚本文件等文件时遇到问题,因为它们位于包含/链接它们的文件之外。

例如,假设这是调用所有内容的主文件的位置:

my website directory/admin/thefilewhereeverythingwillbecalled.php

thefilewhereeverythingwillbecalled.php 中,我必须调用位于包含 thefilewhereeverythingwillbecalled.php 的文件夹外的 db.php

例如我的网站目录/-这是 db.php 所在的目录-/thefilewhereeverythingwillbecalled.php - 样式表和脚本也是如此。

然而,样式表和脚本位于文件夹 cssandjs(包含所有样式表和脚本文件)中,该文件夹位于 thefilewhereeverythingwillbecalled.php

的位置之前

例如我的网站目录/-这里是cssandjs文件夹所在的位置-/thefilewhereeverythingwillbecalled.php

一般来说,我只是在链接调用这些文件的文件之外的文件时遇到问题。有人可以告诉我如何链接它吗?

我试过这个:

../cssandjs/style.css./cssandjs/jquery.js 但它们都不起作用

最佳答案

如果我是正确的,它是 2 个目录。试试这个:

../../cssandjs/style.css

如果/cssandjs/在您的网站目录中,这将起作用。您应该更具体地使用您的目录名称,而不是 -here is where this is located-

似乎无法弄清楚哪些在同一个文件夹中。

关于php - 链接文件(样式表、脚本文件、图像等),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10581947/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com