php blog网站开发实例教程 本章介绍一个基于文本的简易BLOG系统,当然我们可以利用这款blog系统的开发,很好的理解php网站开发原理了,其实网站开发容易于博客开哦,下面来看功能模块。
本章介绍一个基于文本的简易blog系统,当然我们可以利用这款blog系统的开发,很好的理解php网站开发原理了,其实网站开发容易于博客开哦,下面来看功能模块。
post.php 读文件并显示日志内容的php程序。
page.html 显示日志文章的html文档。
style.css教程 页面显示效果的css代码。
add.php 添加blog文章的php程序。
config/auth.php 用户名和密码配置文件。
index.php blog首页程序。
edit.php 编辑blog文章的程序。
delete.php 删除blog文章的程序。
archives.php 归档显示blog文章的程序。
logout.php 退出登录的程序。
*/
//post.php 读文件并显示日志内容的php程序。
<?php if(!isset($_get['entry'])) { echo '请求参数错误'; exit; } $post_data = array(); $path = substr($_get['entry'],0,6); //日志存储目录 $entry = substr($_get['entry'],7,9); //日志文件名称 $file_name = 'contents/'.$path.'/'.$entry.'.txt'; if(file_exists($file_name)) { $fp = @($file_name, 'r'); if($fp) { flock($fp, lock_sh); $result = fread($fp, filesize($file_name)*100); } flock($fp, lock_un); fclose($fp); } $content_array = explode('|', $result); $post_data['subject'] = $content_array[0]; $post_data['date'] = date('y-m-d h:i:s',$content_array[1]); $post_data['content'] = $content_array[2]; //print_r($post_data); ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <title>基于文本的简易blog</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="container"> <div id="header"> <h1>我的blog</h1> </div> <div id="title"> ----i have dream.... </div> <div id="left"> <div id="blog_entry"> <div id="blog_title"><? echo $post_data['subject'];?></div> <div id="blog_body"> <div id="blog_date"><? echo $post_data['date'];?></div> <? echo $post_data['content'];?> </div><!--blog_body--> </div><!--blog_entry--> </div> <div id="right"> <div id="sidebar"> <div id="menu_title">关于我</div> <div id="menu_body">www.php.cn</div> </div> </div> <div id="footer"> copyright 2007 </div> </div> <body> </html>
//page.html 显示日志文章的html文档。
代码如下
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <title>blog</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="container"> <div id="header"> <h1>我的blog</h1> </div> <div id="title"> ----i have a dream.... </div> <div id="left"> <div id="blog_entry"> <div id="blog_title">日志文章标题</div> <div id="blog_body"> <div id="blog_date">2007-12-01</div> 日志文章内容 </div> </div> </div> <div id="right"> <div id="sidebar"> <div id="menu_title">关于我</div> <div id="menu_body">www.php.cn</div> </div> </div> <div id="footer"> copyright 2007 </div> </div> <body> </html>
以上就是php blog网站开发实例教程,更多相关实例课程请关注:php网站开发实例教程

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

禪工作室 13.0.1
強大的PHP整合開發環境

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器