doujia9833 2012-03-05 20:24
浏览 45
已采纳

在服务器中运行PHP并仅显示结果

I have searched in a lot of places and didn't find any solution for my problem properly.. I have a PHP code that is taking about 1 minute to retrieve the informations, becouse it's fetching urls in a Open Graph php, so it has to open a lot of sites, find the meta datas (like: title, images, descriptions) and echo it for me... So, the whole system is working fine, but every time an user enters the site the php code has to do all the work again retrieving the meta datas and stuff...

I need to create a system that run the PHP in the background server and store the information, so when the user enter the site, all the work would be already done, showing only the results... any idea?

I did this test:

After the 1 min waiting and with the page already open showing the results, I entered in the Source Code, copied all the content and create a new .html page (copy and pasting the code generated), and of course everything was transformed in a simple html code showing the php results... And everything loaded in a sec, becouse all the Open Graph process was already done.. That is what I need, but automatically..

(english is not my main language, so, you know) :)

  • 写回答

3条回答 默认 最新

  • dongxu6418 2012-03-05 20:25
    关注

    Add the results to a database or cached file. Have a cron script which runs the script that takes a long time, but modify the script to save the output to the file or database. Then, have your user-facing script simply retrieve the contents of the file/database.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助