【发布时间】:2017-04-05 15:57:46
【问题描述】:
每天,您下载一个包含 url 的 txt 文件,然后我必须手动更新下拉菜单的 index.html 文件。有没有办法自动更新 url 而无需编辑索引文件?这是一个示例,说明如何拨打每天消耗的 file.txt 以及索引文件代码的一部分。
Text1、Text2 和 Text3 保持不变,而 url 每天都在变化
File_url.txt
<a href='http://example.com/update1/day1.txt'>text1</a><br/>
<a href='http://example.com/update2/day1.txt'>text2</a><br/>
<a href='http://example.com/update3/day1.txt'>text3</a><br/>
在索引文件中,url是这样插入的
文件 index.html
<!DOCTYPE html PUBLIC>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>CSS DropDown Menu</title>
<link rel="stylesheet" type="text/css" href="css/reset.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/simple.css" media="screen" />
</head>
<body>
<div id="drop-menu">
<ul id="menu">
<li><a href="http://example.com/home.php"target="principale" >Home</a></li>
<ul>
</ul>
</li>
<li><a href="#"target="principale" >Extra</a>
<ul>
<li><a href='http://example.com/update1/day1.txt'target="principale">text1</a><br/></li>
<li><a href='http://example.com/update2/day1.txt'target="principale">text2</a><br/></li>
<li><a href='http://example.com/update3/day1.txt'target="principale">text3</a><br/></li>
</ul>
</li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<iframe name="principale" src="http://example.com/home.php" marginheight="50" height="800" width="100%" allowfullscreen = "true" ></iframe>
</body>
</html>
比如第二天就能找到
File_url.txt
<a href='http://example.com/update1/day2.txt'>text1</a><br/>
<a href='http://example.com/update2/day2.txt'>text2</a><br/>
<a href='http://example.com/update3/day2.txt'>text3</a><br/>
有没有办法自动更新引用 Url,可能使用永远不会改变的 Text1、Text2 和 Text3?
【问题讨论】:
-
写index.html的代码在哪里?为什么不将其粘贴在 index.php 中并使其成为索引文件(而不是静态 index.html)。直接读取 File_url.txt 并动态生成您的下拉列表。
-
我编辑了帖子,现在index.html / index.php文件已经完成
-
您能否删除标签 php,因为此问题不再与 php 相关,所选答案也不反映 php。谢谢你