全部
我正在我的兄弟网站上工作,他在“publich_html”上获得了“BreadCrumbs.php”,其中index.html也在那里。
在public_html中,我有几个文件夹,如“关于我们”,“职业”和html文件也在那里。现在,当我将“BreadCrumbs.php”链接到Index.html文件时,它会显示结果,但是当我将相同的链接放入(即关于us.html在“关于我们”文件夹中时,它无法正常工作。
我只是想知道我应该如何定义包含路径,以便它也适用于文件夹。 像这样...
的public_html
|
| __ index.html
| __ BreadCrumbs.php
| __关于我们> aboutus.html (文件位于文件夹中)
|
| __职业生涯> career.html (文件位于文件夹中)
很少帮助真的很合适。
添加到我的帖子我有这个代码
include_once('class.breadcrumb.inc.php');
$breadcrumb = new breadcrumb;
echo "<p>".$breadcrumb->show_breadcrumb()."</p>";
它唯一适用于index.html文件。不适用于文件夹中的其他文件
感谢
答案 0 :(得分:0)
我使用以下方法来解决问题:
$about = HTTP_SERVER . 'folder/about.html';
HTTP_SERVER
会将您的链接从about.html
转换为http://www.yourhost.com/about.html
注意:除非您使用Mod Rewrite将php扩展转换为html,否则您只需要在PHP扩展名(* .php)的页面中使用PHP代码。
答案 1 :(得分:0)
您可以考虑目录结构并从更深层次进行包含。
在public_html中:include("./class.breadcrumb.inc.php");
在子文件夹中:include("../class.breadcrumb.inc.php");
希望这有帮助!