首页 > 后端开发 > php教程 > 强烈推荐静态新闻列表自动生成程序。_PHP教程

强烈推荐静态新闻列表自动生成程序。_PHP教程

WBOY
发布: 2016-07-13 17:27:43
原创
844 人浏览过

PHP代码:-------------------------------------------------------------------------------- /* 版权所有:日出东方XP 2004.7.17 */ function CreateShtml() { ob_start(array("callback_CreateShtml","callback_GoToShtml")); } function callback_CreateShtml($buffer) { $page = intval(@$_REQUEST["page"]); $fileName = $_SERVER[DOCUMENT_ROOT] . dirname($_SERVER[PHP_SELF]) . "/" . basename($_SERVER[PHP_SELF],".php") . ($page==0 ? "" : "_" . strval($page)) . ".htm"; $fp = fopen($fileName,"wb"); fwrite($fp,$buffer); fclose($fp); return $buffer; } function callback_GoToShtml($buffer) { $page = intval(@$_REQUEST["page"]); $fileName = basename($_SERVER[PHP_SELF],".php") . ($page==0 ? "" : "_" . strval($page)) . ".htm"; header("location:" . $fileName); return $buffer; } function GoToShtml() { $page = intval(@$_REQUEST["page"]); $fileName = basename($_SERVER[PHP_SELF],".php") . ($page==0 ? "" : "_" . strval($page)) . ".htm"; if(file_exists($fileName)) header("location:" . $fileName); } function DeleteShtml($fileName=NULL) { if(is_null($fileName)) $fileName = $_SERVER[DOCUMENT_ROOT] . $_SERVER[PHP_SELF]; if($fileName[0]=="/") $fileName = $_SERVER[DOCUMENT_ROOT] . $fileName; $path = dirname($fileName); $dir = dir($path); $patten = "/^" . basename($fileName, ".php") . "(_[0-9]+)?.htm/"; while(($entry = $dir->read())!==false) { if(is_file($path . "/" .$entry) && preg_match($patten,$entry)) unlink ($path . "/" . $entry); } }

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/531851.htmlTechArticlePHP代码:-------------------------------------------------------------------------------- /* 版权所有:日出东方XP 2004.7.17 */ function CreateShtml() { ob_start(array(cal...
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板