PHP半路出家(3)
前言
反思了最近写的一些东西,有些小感触
对于学过java或C++的coder来说,
老说语法也没啥意思,OOP,异常之类的技术
不是看看简单的实例代码就能会的,
不懂的可以google喽~
START!
暂时不在blog上写死知识了,还是暂时先在blog上写blog吧~
计划是Practical PHP and MySQL书中第一个实例.
需要一个良好的存储模型数据库中需要建立的3个表
用相关的id的进行各个数据之间的匹配
blog的大体逻辑框架 config.php功能 : 提供常量,一般是一些简单的配置.
内容 :
数据库---[host] [username] [password] [dbname]
博客相关---[博客名称] [作者] [主页的根目录]
header.php功能 : 给每个博客页面的初始化工作
内容 :
每个页面的博客顶部标题---html
数据库连接---MySQL
登陆验证---正确登陆后可以进行博客管理---SESSION
footer.php功能 : 在每个页面底部添加作者标志.
内容 : © Matter
index.php功能 : 显示文章 , 查看评论 , 显示以前文章
内容 :
在数据库查询文章---MySQL
显示文章标题和内容---PHP
viewentry.php功能 : 利用锚点,查看评论,并添加评论
内容 :
先验证,获取id号---GET
连接数据库,查找对应ID的文章---MySQL
查找所有评论---MySQL
显示文章,评论---php
提交评论的表单---html
viewcat.php功能 : 分类浏览
内容 :
判断请求的id---php
显示相应ID下所有文章---MySQL
Login.php功能 : 登陆---session
Logout.php功能 : 登出---session
addentry.php功能 : 添加文章
内容 :
验证用户---session
写分类和文章---html
添加内容到数据库
updateentry.php功能 : 修改文章
内容 :
验证
数据库的UPDATE命令
编码小收获
1.date()时间格式
date()符号 | 日期 |
D | Sat |
D j | Sat 12 |
D jS | Sat 12th |
D jS F | Sat 12th May |
D jS F Y | Sat 12th May 2012 |
D jS F Y g | Sat 12th May 2012 3 |
D jS F Y g. | Sat 12th May 2012 3. |
D jS F Y g.i | Sat 12th May 2012 3.06 |
D jS F Y g.iA | Sat 12th May 2012 3.06PM |
2.页面设计的时候,可以用header和footer文件,产生固定的效果
3.SQL语句简单格式 : SELECT(选择)--WHERE(条件)--ORDER BY(排序)--DESC(倒序)--LIMIT(限制)
4.用config.php文件保存一些配置信息常量
5.对$_GET和$_POST超级全局变量的使用概览
6.用手过了一遍数据库和网页的编程实践
小感想
这是我的第一个PHP+MySQL的小程序 , 做这个的动机是学习PHP时自以为语法到位了 , 想试试手 . 但遇到了不少困难 .
好的方面 了解了部署一个服务器上的BLOG的流程 , 和原理 .
对PHP在编程中的角色有了一定的理解
使用MySQL和页面互动
了解了锚点,session等以前只是听说过的内容
坏的方面 跟书编码 , 整体感不够(在博客里总结一遍,算是清晰一点吧).
HTML布局和CSS样式掌握的不好 , 这两方面导致我的页面总是莫名其妙的乱了 .
还有SQL语言掌握的不太好 , 只会很"质朴"的操作,没掌握的感觉很明显

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Alipay PHP...

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.
