Skip to Content
PHP、MySQL 与JavaScript 学习手册
book

PHP、MySQL 与JavaScript 学习手册

by Robin Nixon
October 2020
Intermediate to advanced
796 pages
15h 15m
Chinese
China Electric Power Press Ltd.
Content preview from PHP、MySQL 与JavaScript 学习手册
94
4
更合理的做法是把网站分成不同的部分,分别开发。例如,多数网站支持注册,在
此过程中,我们要验证电子邮件地址、判断用户名是否已被使用等。
此外,可能还需要登录功能,登录后再让用户查看网站的主体内容。接着,或许还
有一个消息模块,供用户发表评论,包含链接和有用信息的模块,以及上传图像的
模块等。
用户在网站中的操作可以通过
cookie
或会话变量(后面的章节详述)记录,如此以
来我们便可以合理划分,把网站分成不同的
PHP
代码模块,各模块自成一体。这样
做的好处未来能体现出来,我们可以在维护旧功能的基础上,增加新功能。如果身
在团队之中,不同的人可以负责不同的模块,这样每个程序员便可以专攻一项技术。
4.7
动态链接实例
现今,网上最受欢迎的
PHP
应用之一是博客平台
WordPress
(见图
4-5
)。写博客或
看博客的人可能没有发现,
WordPress
的每个主要模块是分别放在单独的
PHP
文件
中的,通用的函数也放在单独的文件中,在需要用到的
PHP
页面中再引入。
4
-
5
:博客平台 WordPress 的控制台
整个平台由看不见的会话整合在一起,你很难察觉从一个模块转到另一个模块了。
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

深度学习:核心原理与案例分析

深度学习:核心原理与案例分析

Posts & Telecom Press, Ahmed Menshawy
《PHP 编程》,第 4 版

《PHP 编程》,第 4 版

Kevin Tatroe, Peter MacIntyre
ADO.NET Cookbook

ADO.NET Cookbook

Bill Hamilton
FreeBSD® Unleashed

FreeBSD® Unleashed

Brian Tiemann, Michael C. Urban

Publisher Resources

ISBN: 9787519845827