【发布时间】:2015-02-04 10:45:38
【问题描述】:
无论如何,例如当我导航到http://example.com/links/pages/index.html时
我在 /pages 目录中有 4 个 .html 文件,名称分别为 page1.html、page2.html、page3.html、page4.html
那么 index.html 必须向我显示此 /pages 目录中存在的页面列表吗?没有我自己手动在 index.html 上列出它们。当我在 /pages 目录创建新页面时,我只希望它们在 index.html 中列出
这里有一些例子,希望对你有帮助:http://plnkr.co/edit/kIiod2DR6zgSpmuUNsUi?p=preview
或者这个例子
<!-- This is index.html page in this directory http://example.com/links/pages/index.html -->
<html>
<head>
</head>
<body>
<!-- here must be listed pages that is exist in this directory /pages -->
<!-- example for to be listed -->
<ul>
<li><a href="page1.html">page 1</a></li>
<li><a href="page2.html">page 2</a></li>
<li><a href="page3.html">page 3</a></li>
<li><a href="page4.html">page 4</a></li>
</ul>
</body>
</html>
【问题讨论】:
-
PhP 函数
scandir()似乎满足您的需求 (php.net/manual/en/function.scandir.php)。 -
这是可能的,但当您的页面具有扩展名 .html 时就不行
标签: javascript php jquery html