1

我从用户那里获取 url 并使用获取该 url 的文本

$data=file_get_content($url)

我正在从此 $data 中提取标题、图像 url。并存储到表格中并在前端urlrecord的 div 中显示。D1

之后我执行处理,$data这需要很少的时间,这给了我结果$x$y. (x 和 yi 不会出现在D1)

x and y我也必须存储在urlrecord表中。

$data如果我在获取之前执行处理,x and y那么在前端显示 url 内容D1将被延迟。

所以我想要的是:

将 URL 内容存储到表中后,我执行 $data 处理。并将 $x 和 $y 存储到同一张表中。

底线是我不想反映 $data 处理以使 x,y 影响前端的显示 url 内容。

有人可以在这里认为最佳方案吗?

4

1 回答 1

0

I think you can create a cronjob to do the $data processing.

For example, there's a flag column in table urlrecord, default to 1, and the cronjob will scan the table every 5 mins, "select * from urlrecord where flag=1", calculate x and y, and update the flag to 2.

于 2013-11-15T11:00:54.200 回答