2012-05-14 182 views
0

我有鏈接文件,如樣式表,圖像,數據庫連接文件(db.php),腳本文件等問題。因爲它們位於外部包含/鏈接的文件。鏈接文件(樣式表,腳本文件,圖像等)

例如假設這是主文件的位置,這裏的一切將被稱爲:

my website directory/admin/thefilewhereeverythingwillbecalled.php 

thefilewhereeverythingwillbecalled.php,我必須調用位於包含thefilewhereeverythingwillbecalled.php

的文件夾以外的db.php中

例如my website directory/-this is the directory where the db.php is located-/thefilewhereeverythingwillbecalled.php - 樣式表和腳本也是如此。

但是樣式表和腳本是在文件夾cssandjs(包含所有樣式表文件和腳本文件),其在此文件夾位於的thefilewhereeverythingwillbecalled.php

例如位置之前my website directory/-here is where the cssandjs folder is located-/thefilewhereeverythingwillbecalled.php

通常我只是有一個鏈接文件之外的文件,它稱爲這些文件的問題。有人可以給我一個想法如何鏈接它嗎?

我嘗試這樣做:

../cssandjs/style.css./cssandjs/jquery.js但他們沒有工作

+0

您可以發佈您的嘗試示例 –

+1

傑克錘在哪裏,我需要拆除這個文本牆。 – Petah

+0

@Petah - > lol。我盡我所能編輯它。無法理解超越一點。 –

回答

0

如果我是正確的,這是2節目錄了。試試這個:

../../cssandjs/style.css 

這將工作,如果/ cssandjs /在你的網站目錄。 你應該多一點具體與您的目錄名代替,尤其是圓形就是這是located-

似乎無法找出哪些是在同一個文件夾中。

+0

會感謝,像魅力一樣工作 –

+0

不客氣:) – Anonymous

0

嘗試包括完整路徑的文件。

0

嘗試像 $ _SERVER ['DOCUMENT_ROOT']。「/ dirName/file.ext」引用包含目錄和文件的文件。

或使用相對路徑「../dirnName/file.ext」;

第一種方法是首選