English 中文(简体)
我应如何以实事求是的方式把一个偏僻的网页碎片列入营地?
原标题:How should I include a remote page fragment in php in a performant way?

Im在Droupal的一个站点工作,该站点将设在http://sub.clientdomain.com/,从的服务器中填入一个静态的html碎块,我需要在一个网页上展示,以便为一个站点提供一种母体。

我工作在甚高频中,因此,我能够获得治疗、植被和我想要安装的东西。

这样做的最佳方式是什么?

最佳回答

Your first approach sounds like a good idea. By using a cronjob, the pulling of the content is separated from your site, so the user doesn t have to wait. If you have access to the page that generates the fragment, you could reduce net traffic by actively sending the new content instead of requesting it every couple of minutes.

我将碎块储存在一个数据库中,但我认为数据库序列比查阅档案系统更快。

问题回答

我在此采取的第一个做法是使用curl <>/code>,每n <>>>m>分钟打入html碎块,然后将其储存在/var/www/html/site等地方,以节省对每一负荷的网上要求。

然后,我使用<代码>file_get_contents功能,将内容输入网页,如果档案中有点(例如,档案中有点)。

我在此补充说,这主要是一种先天检查,希望看到其他办法。

如果这一主要领域位于同一个服务器上,你可能可以直接使用,因此,仅使用简单的include,并以绝对途径标明静态html文档。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...