您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

自动发布新闻的php代码

2026/2/8 12:46:37发布5次查看
新闻文件以文本文件.txt的格式存放在一个固定的目录下,新闻的发布可以自动完成,该过程由两部分组成: 第一是新闻的显示,由shownews.php脚本实现,代码如下: 
read()) { $s = strtolower($filename); if (strstr($s, .txt)) { $lastchanged = filemtime($newspath . $filename); $newsfile[$filename] = $lastchanged; }}arsort($newsfile);for (reset($newsfile); $key = key($newsfile); next($newsfile)) { print n; $fa = file($newspath . $key); $s = trim($fa[0]); $s = htmlspecialchars($s); $lk = strlen($key); $a = substr($key, 0, $lk - 4); $s = . $s . ; print $s . n; print ( . date(y年m月d日 - h:i:s, $newsfile[$key]) . ) n; print
;}$hd->close();?>
在显示新闻的地方放入代码: 用数据库也可实现,这只是文件形式的实现方式。
文章网址:
随意转载^^但请附上教程地址。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product