search
Homephp教程php手册PHP生成HTML静态页面实例代码

PHP生成HTML静态页面实例代码

Jun 13, 2016 pm 12:26 PM
htmlphpforcodeFunctionOriginalExampledevelopgeneratewebsitestaticpage

为cd2sc.com网站功能而开发,代码为本人原创,生成速度一般。
(出于众所周知的原因,涉及到数据库的数据字段名称做了改动,并且为了代码明晰去掉了参数过滤的部分)

说明:原动态地址为 moban.php?id=1 ,生成后地址为 html/200808/sell_1.html 。page.php为分页程序,本博客中有发布。
页面使用方式,将本代码保存为make.php,使用方法为浏览器访问 make.php?t=数量&pg=页面;例如 make.php?t=300&pg=2,即每次生成300条数据,从数据列表第2页开始生成,即跳过前面300条。如果不加任何参数,直接访问make.php,则默认每次生成200条,从第一页开始生成。

复制代码 代码如下:


if($_GET[pg]==''){
$aa=1;
}else{
$aa=$_GET[pg];
}
include("admin/conn.php");
require_once("page.php");
$result=mysql_query("select * from 2carsell ");
$totle=mysql_num_rows($result);
$pagelist = $_GET[t];
if($_GET[t]==''){
$pagelist='200';
}else{
$pagelist=$_GET[t];
}
$pager = new Pager($totle,$pagelist);
$datastat=" 共 ".$pager->countall." 条,每次生成 ".$pager->countlist." 条,共需生成 ".$pager->page." 次";//数据统计
$bb=$pager->page;
$pagenav=$pager->backstr.$pager->thestr.$pager->nextstr;
$limitFrom = $pagelist*($pager->pg-1);
$result=mysql_query("select * from 2carsell ORDER BY id DESC limit $limitFrom,$pagelist");
?>

次页面生成中.. echo $datastat?>



print "







echo $datastat."  "?>




$aa=$aa+1;
if($aa>$bb){
echo '恭喜,所有页面生成完毕!';
echo "<script>alert('所有文档生成/更新完毕!')</script>";
}else{
echo "<script> window.location='make.php?t=$pagelist&pg=$aa'; </script>";
}
?>
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft