【发布时间】:2012-09-21 06:59:07
【问题描述】:
我正在寻找一种使用 PHP 执行以下操作的方法。
文件夹 /section/ 中有多个页面。红色.html、蓝色.html、绿色.html。并且在服务器的根目录下有一个index.html页面。
在每个页面上,都有一个 id 为“list”的 div,其中包含一个带有列表项的 ul。如何在 /section/ 中的每个页面上检索此 div 中列表项的数量,并返回 index.html 页面上每个页面的数量。
为了更好地说明它:
每一页的结构:
<div id="list">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
red.html (33 list items within #list)
blue.html (20 list items within #list)
green.html (15 list items within #list)
index.html:
**Stats:**
Red: <php here fetching the number from red.html>
Blue: <php here fetching the number from blue.html>
Green: <php here fetching the number from green.html>
【问题讨论】:
-
所以你想使用 php 从所有这些页面中获取 li 并将它们显示在一个页面上。这就是你想要的吗??
-
我正在尝试找到一种方法来获取 div 内每个单独页面上的 li 总数,并将总数返回到根目录中的 index.html 页面。如果 red.html 上的#list 中有 20 个列表项,我希望将数字显示在根目录的 index.html 页面上。
标签: php html html-lists return