doupao1978 2014-05-24 07:58
浏览 25

脚本php动态创建站点地图

I have a question. I have site. In one page I want put edit box with button. When user put any url to edit box and press button, site must return sitemap (like this site www.xml-sitemaps.com/). Is there a script php, which creates a sitemap based on any url? I mean create sitemap generator. My example code:

    <html>
    <head></head>
    <body>
    <form id="CreateSiteMap" method="post" action="ParseUrl.php">
     <p>Input url site:</p>
     <input type="text" size="40" name="URL">
     <input type="submit" value="Generate">
    </form>
    <?php
        function ParseURL($URL_SITE)
        {
            //Create tree of site
            return array("/Contacts.html", "/FAQ.html", "/Index.html");//For example
        }
      if( $_POST["URL"]  )
      {
         echo '<div id="Sitemap">';
         echo 'Sitemap '.$_POST["URL"]."<p>" ;
        foreach (ParseURL($_POST["URL"]) as $i => $value) {
             echo $_POST["URL"].$value."<br/>";
        }
         echo '</p></div>';
         exit();
      }
    ?>
    </body>
    </html>
  • 写回答

1条回答 默认 最新

  • doumiebiao6827 2014-05-24 08:23
    关注

    i think will be easy to create a file sitemap.php and add all the urls on it.

    return array(
    "users" => "application/controllers/users",
    "secure" => "application/controllers/secure",
    "advert" => "application/controllers/advert",
    "notfound" => "application/controllers/Notfound",
    "controller" => "vendor/controller",
    "bootstrap" => "vendor/bootstrap",
    "autoload" => "vendor/autoload",
    "methods" => "vendor/methods",
    "database"=>"vendor/database",
    "model" => "vendor/model"
    );
    

    ofcourse you will not put database

    评论

报告相同问题?

悬赏问题

  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题