我正在开发 www.sciencedaily.com 的小型移动应用版本。只是一个小项目。
我正在使用 RSS_PHP 来获取 XML 提要,我拥有的代码(效果很好)在 DOCTYPE 之前看起来像这样:
require_once '_/rss_php.php';
$featuredRSS = new rss_php;
$healthMedRSS = new rss_php;
$mindBrainRSS = new rss_php;
$plantsAnimalsRSS = new rss_php;
$earthClimateRSS = new rss_php;
$spaceTimeRSS = new rss_php;
$matterEnergyRSS = new rss_php;
$compMathRSS = new rss_php;
$archaeoRSS = new rss_php;
$featuredRSS->load('http://www.sciencedaily.com/rss/top_news/top_science.xml');
$healthMedRSS->load('http://www.sciencedaily.com/rss/health_medicine.xml');
$mindBrainRSS->load('http://www.sciencedaily.com/rss/mind_brain.xml');
$plantsAnimalsRSS->load('http://www.sciencedaily.com/rss/plants_animals.xml');
$earthClimateRSS->load('http://www.sciencedaily.com/rss/earth_climate.xml');
$spaceTimeRSS->load('http://www.sciencedaily.com/rss/space_time.xml');
$matterEnergyRSS->load('http://www.sciencedaily.com/rss/matter_energy.xml');
$compMathRSS->load('http://www.sciencedaily.com/rss/computers_math.xml');
$archaeoRSS->load('http://www.sciencedaily.com/rss/fossils_ruins.xml');
$featuredItems = $featuredRSS->getItems();
$healthMedItems = $healthMedRSS->getItems();
$mindBrainItems = $mindBrainRSS->getItems();
$plantsAnimalsItems = $plantsAnimalsRSS->getItems();
$earthClimateItems = $earthClimateRSS->getItems();
$spaceTimeItems = $spaceTimeRSS->getItems();
$matterEnergyItems = $matterEnergyRSS->getItems();
$compMathItems = $compMathRSS->getItems();
$archaeoItems = $archaeoRSS->getItems();
然后,在内容中,我通过使用经典的东西来呼应结果,比如
foreach($items as $item) {
echo $item['title'];
}
etc...
就像我说的,一切都很好。但它慢得要命。我知道应用程序的速度会受到限制,因为它必须抓取提要,但是 RSS_PHP 没有像 SimplePie 那样的缓存能力。
关于提高速度的任何想法?也许先加载精选内容然后再加载其他所有内容?
提前致谢!!