dovgqc2648 2014-02-03 09:47
浏览 27
已采纳

我想废弃本地Web目录中的数据

All the pages are connected via some href elements. The very first page is named mainpage.html. Now I want to remove the <image> tags from all the webpages and show elements within <div id = "pB">.

Instead of removing image tags manually from one page to another, I'd like a generic method for this purpose. Any suggestions or queries from me you can ask me, thanks in advance.

the structure of tree is

<html> -> <body> -> <div id= pB>
  • 写回答

1条回答 默认 最新

  • duanli5662 2014-02-03 11:23
    关注

    As the structure and aim of your project are not totally clear to me, i will try to give you some hints for the various aspects i can identify. I am assuming a solution in PHP.

    find all pages from within your mainpage.html: Regexp for extracting all links and anchor texts from HTML

    or even more elegant

    Regexp for extracting all links and anchor texts from HTML

    alternatively, you mentioned a "local web directory" so you could also get all files via

    http://de1.php.net/manual/en/function.glob.php

    Assuming you have all the filenames of files you want to parse in an $array, you could iterate over that array, open each file and use the mentioned modification from here

    http://www.php.net/manual/en/function.strip-tags.php#86964

    Either you then save your modified pages or you display them in your div.

    Hope this helps a bit.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 我想在一个软件里添加一个优惠弹窗,应该怎么写代码
  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流