Home >Backend Development >PHP Tutorial >A personal web page automatic generation system 1_PHP tutorial

A personal web page automatic generation system 1_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:26:11825browse

Before you want to use this system to create your personal homepage, I believe you have already configured the relevant Apache server, MYSQL database, and PHP.
Then start your mysql database, create a database named study, and create a table named wenzhang.
Create the following fields under phpMyAdmin:
id smallint(5) No 0 auto_increment
timu varchar(200) Yes
zuozhe varchar(18) Yes
laiyuan varchar(40) Yes
textt text Yes
riqi datetime Yes
Single page submission. File name: input.php


Untitled Document






Single page generation, file name: shengcheng.php


$db = mysql_connect ("localhost", "root");
mysql_select_db("study",$db);
// Write the article to the database
$t = date("Y-m-d h:i:s") ;
$sql = "INSERT INTO wenzhang (timu,zuozhe,laiyuan,textt,riqi)
VALUES ($timu,$zuozhe,$laiyuan,$textt,$t)";
$result = mysql_query($sql);
// Increment the counter by one
$fdd=fopen("count.txt","r");
$cdd=fread($fdd,5);
$cdd++;
fclose($fdd);
$fdd=fopen("count.txt","w");
fwrite($fdd,$cdd);
fclose($ fdd);
// Article generation
$muoban1 = fopen("muoban1.txt","r");
$muoban2 = fopen("muoban2.txt","r");
$muoban3 = fopen("muoban3.txt","r");
$qita = "

Author: $zuozhe
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