上,我想找到一種方法,包括基於當前的文件路徑上的一些文件。例如:PHP動態包括基於當前的文件路徑
我有「website.com/templates/name1/index.php 「,這個」index.php應該是一個獨特的文件,我將在不同深度的許多不同目錄中使用,所以我想使代碼具有通用性,因此我不需要在該文件內部更改任何內容。「
所以如果這個「index.php」位於
「」website.com /templates/name1/index.php「
比它應該包括位於這裏的文件:
「website.com/content /templates/name1/content.php」
另一個例子:
「website.com /templates/name2/index.php」
比它應該包括文件位置爲:
「website.com/content /templates/name2/content.php」
此外想超限「警告:include_once()的[一次function.include]:HTTP://封裝被禁用在服務器配置中通過allow_url_include = 0「類型的錯誤..因爲被禁用和不安全..
有沒有辦法實現這個? 謝謝!
一般來說,代碼只-答案被認爲是質量差。也許你可以提供一個解釋這裏發生了什麼的片段? – corsiKa 2012-11-13 19:02:32