php 新闻标题,PHP语言之一个设计将LinuxFreak.org新闻标题放置到你的网站

本文主要向大家介绍了PHP语言之是一个设计将LinuxFreak.org新,通过具体的内容向大家展示,希望对大家学习php语言有所帮助。

// bi bolo monggole huen !

//

// v2.0.5

// // include("linuxfreak.php3");

// ?>

// dreamphp boy = sunboy

$link_prefix = " o ";

$link_postfix = "

n";

$cache_file = "/tmp/linuxfreak2.cache";

$cache_time = 1200;

$max_items = 8;

$target = "_top";

// End of customizations

$backend = "http://www.linuxfreak.org/backend/linuxfreak.rdf";

$items = 0;

$time = split(" ", microtime());

srand((double)microtime()*1000000);

$cache_time_rnd = 300 - rand(0, 600);

if ( (!(file_exists($cache_file))) || ((filectime($cache_file) + $cache_time - $time[1]) + $cache_time_rnd < 0) || (!(filesize($cache_file))) ) {

$fpread = fopen($backend, r);

if(!$fpread) {

} else {

$fpwrite = fopen($cache_file, w);

if(!$fpwrite) {

} else {

while(! feof($fpread) ) {

$buffer = ltrim(Chop(fgets($fpread, 256)));

if (($buffer == "") && ($items < $max_items)) {

$title = ltrim(Chop(fgets($fpread, 256)));

$link = ltrim(Chop(fgets($fpread, 256)));

$title = ereg_replace( "", "", $title );

$link = ereg_replace( "", "", $link );

$link = ereg_replace( "", "", $link );

fputs($fpwrite, "$link_prefix$title$link_postfix");

$items++;

}

}

}

fclose($fpread);

}

fclose($fpwrite);

}

if (file_exists($cache_file)) {

include($cache_file);

}

?>

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标编程语言PHP频道!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值