1、配置文件的编写:config.php
<?php
header(“Content-type;text/html;charset=utf-8”);
define(‘HOST’,’127.0.0.1’);
define(‘USERNAME’,’root’);
define(‘PASSWORD’,’root’);
?>
2、mysql初始化程序文件的编写:connect.php
<?php
require_once(‘config.php’);
$con = mysql_connect(HOST,USERNAME,PASSWORD);
mysql_select_db(‘info’);//选数据库
mysql_query(‘set names uft8’);
3、文章发布后台article.add.handle.php
<?php
require_once(‘../connect.php’);
if(!(isset($_POST[‘title’])&&(!empty($_POST[‘title’])))){
echo “<script>alert(“标题不能为空”);window.location.href=’article.add.php’</script>