简体   繁体   English

使用MySQL的php中的随机报价生成器

[英]random quote generator in php using mysql

i coded a random quote generator in php using mysql but also jquery. 我使用mysql和jquery在php中编码了一个随机报价生成器。 however when i try to integrate it with facebook, since i opted to use fbml, i could not use jquery. 但是,当我尝试将其与Facebook集成时,由于我选择使用fbml,因此无法使用jquery。

how do i get the quote to display randomly in php at say, 30 mins, without using jquery or javascript? 我如何获得报价以30分钟随机显示在php中,而不使用jquery或javascript?

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

Write a script that grabs all quotes from the database, and use rand() to pick one. 编写一个脚本,从数据库中获取所有引号,然后使用rand()选择一个。 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. 然后,只需将您的报价选择器作为cron作业设置为每30分钟运行一次即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM