Three first page press release to make your update easier (medium)
The last time we made a file header (as for the end of the file, please do it yourself, assuming tail.php), a function of the module, now, we come to a basic function of the implementation, that is, dynamic release
Include ("makestr.php";
Include ("head.php");
$newspath = "/announce/"; A directory of news files stored as text files
$newsfile =array ();//Prepare News array
$HD =dir ($newspath); Directory handle
while ($filename = $hd->read ()) {//Get all Files
$s =strtolower ($filename);
if (Strstr ($s, ". txt")) {
Detect the latest modification date
$lastchanged =fileatime ($newspath. $filename);
$newsfile [$filename]= $lastchanged;
}
}
Arsort ($newsfile); File sorted by Time
Output file
for (Reset ($newsfile); $key =key ($newsfile); next ($newsfile))
{$fa =file ($newspath. $key);
$n =count ($FA);
echo "
". Date (" D.m.y-h:i:s ". $newsfile [$key])."
\ n ";
for ($i =0; $i < $n; $i = $i + 1) {
$s =chop ($fa [$i]);//Remove space
$s =htmlspecialchars ($s);
Print $s. "
\ n ";
}
}
$HD->close (); Release handle
Include ("tail.php");
?>
In this way, you can easily post news by passing your news text to the annouce subdirectory of your root directory. But the real convenience is not this, for example, when the news is out of date, the program can automatically delete it, how good. Do not use FTP, directly online to write a new announcement, more convenient. Okay, and listen to the tell.
http://www.bkjia.com/PHPjc/316028.html www.bkjia.com true http://www.bkjia.com/PHPjc/316028.html techarticle three first press release to make your update easier (in) the last time we made a file header (as for the end of the file, please do it yourself, assuming tail.php), a function of the module, now ...