PHP半路出家(3)

Jun 23, 2016 pm 02:30 PM

前言

反思了最近写的一些东西,有些小感触

对于学过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语言掌握的不太好 , 只会很"质朴"的操作,没掌握的感觉很明显

总之,我对自己学习PHP的方向感明晰一些.希望以后能再接再厉!!!

 

 

 

 

 

Statement of this Website
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)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

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-

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

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.

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

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' =>

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

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

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

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

Customizing/Extending Frameworks: How to add custom functionality. Customizing/Extending Frameworks: How to add custom functionality. Mar 28, 2025 pm 05:12 PM

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

Framework Security Features: Protecting against vulnerabilities. Framework Security Features: Protecting against vulnerabilities. Mar 28, 2025 pm 05:11 PM

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

See all articles