如何动态地将值从php脚本传递到另一个脚本?
我想将 url 值从 php 脚本传递到另一个。我有一个数据库,其中存储了一些提要。我给这些提要赋予了一些权重值,并且 php 脚本根据它们的权重随机获取提要 url。我想要获取脚本抓取的提要 url,然后将此 url 传递到另一个 php 脚本中,在该脚本中它将用 simplepie 进行解析以显示其内容。
我在这里发布两个文件的代码:
这是第一个随机抓取提要的脚本 http://pastebin.com/2ciQ87Es 这是第二个脚本,我想在其中传递值并解析提要 http://pastebin.com/eN5qG29e
你有什么可以推荐的吗? 提前致谢
i want to pass a url value from a php script to another.I have a database in which i have stored some feeds.I have given some weight values to these feeds and a php script grabs a feed url randomly based on their weights.I want to take the feed url which has been grabbed by the script and then pass this url in another php script where it will be parsed with simplepie in order to show its content.
I am posting the codes of the two files right here:
this is the first script which grabs randomly the feed
http://pastebin.com/2ciQ87Es
this is the second script in which i want to pass the value and makes the parsing of the feed
http://pastebin.com/eN5qG29e
Have you something to recommend??
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将从数据库中抓取 feed url 包装在一个函数中,然后像任何其他 php 文件一样包含该文件,然后调用该函数。
然后在您需要的页面上:
You could wrap grabbing the feed url from the database in a function, and just include that file like any other php file, and then call that function.
and then on the page where you need it:
$_SESSION 还不够吗?
在第一个脚本中:
在第二个脚本中:
再考虑一下,您是否不能将查询字符串中的值传递到第二页。
Would a $_SESSION not suffice?
In the first script:
In the second script:
On second thoughts, could you not pass the value in a query string, to the second page.