使用 mysql 在 php 中随机报价生成器

发布于 2024-08-28 13:26:38 字数 159 浏览 3 评论 0原文

我使用 mysql 和 jquery 在 php 中编写了一个随机报价生成器。然而,当我尝试将它与 facebook 集成时,因为我选择使用 fbml,所以我无法使用 jquery。

我如何让报价在 php 中随机显示,比如 30 分钟,而不使用 jquery 或 javascript?

i coded a random quote generator in php using mysql but also jquery. however when i try to integrate it with facebook, since i opted to use fbml, i could not use jquery.

how do i get the quote to display randomly in php at say, 30 mins, without using jquery or javascript?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

唐婉 2024-09-04 13:26:38

您可以使用 标签在 facebook fbml 应用程序中使用 jquery 制作的报价解决方案。

You could use your jquery-made quotes solution in facebook fbml app using the <fb:iframe> tag.

夏尔 2024-09-04 13:26:38

编写一个脚本,从数据库中获取所有报价,并使用 rand() 选择一个。然后将报价保存到您希望其显示的文件中。每次运行脚本时,它都应该覆盖该文件,并且您的输出将仅包含用于显示报价的文件。

然后只需将报价选择器作为 cron 作业运行一次,设置为每 30 分钟一次。

Write a script that grabs all quotes from the database, and use rand() to pick one. Then save the quote to a file as you want it to appear. Each time you run the script it should overwrite the file, and your output will just include the file to display the quote.

Then just run your quote chooser as a cron job set to every 30 mins.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文