没有合适的资源?快使用搜索试试~ 我知道了~
首页精通PHP 7:面向对象与模块化编程实战
精通PHP 7:面向对象与模块化编程实战
需积分: 4 10 下载量 53 浏览量
更新于2024-07-18
收藏 5.53MB PDF 举报
"《Learn PHP 7》是一本由Steve Prettyman撰写的专业IT教材,专为学习者设计,旨在引导读者掌握PHP 7编程语言的面向对象(Object-Oriented)模块化编程技术。这本书结合了现代Web开发的热门技术,如HTML5、CSS3、JavaScript、XML、JSON以及MySQL,旨在帮助读者在实际项目中实现高效、可维护的代码。 作者以其深厚的专业背景和丰富的经验,将复杂的技术概念简化,让读者能够在实践中逐步理解和掌握PHP 7的核心原理。书中涵盖了从基础语法到高级应用的全面内容,包括但不限于类和对象的概念、封装、继承、多态等面向对象编程特性,以及如何利用这些特性构建模块化的代码结构。 此外,书中还介绍了如何利用HTML5进行网页设计,CSS3用于美化界面,JavaScript增强交互性,XML和JSON处理数据交换,以及MySQL数据库的使用,这些都为构建功能完善的Web应用程序提供了坚实的基础。作者强调了实践的重要性,书中包含了大量的示例代码和实战项目,以便读者能够通过动手操作来加深理解。 《Learn PHP 7》适合PHP初学者以及有一定基础的开发者进一步提升技能,无论你是希望进入Web开发领域,还是希望提升现有项目的效率,这本书都是一个理想的参考资料。版权信息表明,本书受到严格的版权保护,未经许可不得复制或传播,确保了知识的完整性和原创性。对于想要深入探索PHP 7并将其应用于现代Web开发的读者来说,这是一本不可多得的宝贵资源。"
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/10715969/bg10.jpg)
xviii
■ IntroduCtIon
Chapter 4: Secure User Interfaces
After completing this chapter, the student will be able to:
• Explain why user input must be validated in the interface and business rules tiers
• Explain why user input must be filtered in the business rules tier
• Use HTML5 code to validate user input
• Use JavaScript code to validate user input
• Use PHP if statements (conditional statements) to validate and filter input
• Use foreach loops to dynamically create an HTML select box from an XML file
• Use simple arrays for filtering and validation
• Pass simple arrays into methods (functions)
• Understand how to use dependency injection to control code version changes
Chapter 5: Handling and Logging Exceptions
After completing this chapter, the student will be able to:
• Explain the difference between errors and exceptions
• Create a PHP program that can handle general exceptions
• Create a PHP program that can create, raise, and handle user exceptions
• Explain and use a switch and/or embedded if/else statement
• Create a PHP program that uses the while loop and/or the for loop
• Create a program that reads/updates a text file using a two-dimensional array
• Create a PHP program that logs exceptions and e-mails support personnel
Chapter 6: Data Objects
After completing this chapter, the student will be able to:
• Create a data class that inserts, updates, and deletes XML or JSON data
• Explain how to create a data class that updates MySQL Data using a SQL Script
• Create a PHP program that creates a change backup log
• Create a PHP program that can recover data from a previous backup
• Apply changes to create up-to-date valid information
• Use dependency injection to attach a data class to another class in the BR tier
• Create a three-tier PHP application
![](https://csdnimg.cn/release/download_crawler_static/10715969/bg11.jpg)
xix
■ IntroduCtIon
Chapter 7: Authentication
After completing this chapter, the student will be able to:
• Define sessions and explain how sessions are used for authentication
• Create a PHP program that authenticates user logon
• Create a PHP program that register users
• Create a PHP program that will allow users to change passwords
• Create a PHP program that logs invalid login attempts
Chapter 8: Multifunctional Interfaces
After completing this chapter, the student will be able to:
• Create a complete PHP application that deletes, updates, and inserts data
• Create a professional look to a completed application using CSS
• Use JavaScript to accept and manipulate data from another program
• Secure all programs within an application requiring user IDs/passwords
• Populate HTML objects with values from a JSON object
![](https://csdnimg.cn/release/download_crawler_static/10715969/bg12.jpg)
1
Chapter 1
An Introduction to PHP 7
“PHP is a popular general-purpose scripting language that is especially suited to web
development. Fast, flexible, and pragmatic, PHP powers everything from your blog to the
most popular web sites in the world.” —www.php.net
Chapter Objectives/Student Learning Outcomes
After completing this chapter, the student will be able to:
• Understand the differences between LAMP, WAMP, and MAMP
• Successfully install a version of LAMP, WAMP, or MAMP
• Search the Internet for troubleshooting problems
• Explain the difference between a programming language and a scripting language
• Create an error-free simple PHP program
PHP 5.5+, PHP 7+, and PHP.NET
Today, PHP (Hypertext Preprocessor) is one of the most popular languages used for web application
development. The language has evolved to allow the programmer to quickly develop well-formed error-free
programs using both procedural and objected-oriented programming techniques. It provides the ability
to use many preexisting libraries of code that either come with the basic installation or can be installed
within the PHP environment. This gives you multiple ways to complete a particular task. It provides more
flexibility than many other languages. The ease with which additional libraries of code can be added to the
environment is one of the many driving forces in its popularity.
Procedural language—A procedural programming language includes functions/methods
that can be called from the main flow of the program. The flow of the program jumps to
the function/method, executes the code within the module, and then returns to the next
statement in the main flow of the program. Some Procedural languages include a main
function/method that automatically is called when the program is executed.
© Steve Prettyman 2015
S. Prettyman, Learn PHP 7, DOI 10.1007/978-1-4842-1730-6_1
Electronic supplementary material The online version of this chapter (doi:10.1007/978-1-4842-1730-6_1)
contains supplementary material, which is available to authorized users.
![](https://csdnimg.cn/release/download_crawler_static/10715969/bg13.jpg)
Chapter 1 ■ an IntroduCtIon to php 7
2
Object-oriented language—An object-oriented language uses classes and objects. Classes
are similar to blue prints. A class describes what an object can contain, including
properties/variables and functions/methods. An object is an instance of a class (like a
building that has been created from a blueprint). Object-oriented languages provide
polymorphism, encapsulation, and inheritance. Objects are naturally encapsulated by
containing all related functions/methods and properties/variables within the object itself.
Polymorphism allows duplicate method/function names within object-oriented objects.
However, the “signature” must be different. The “signature” is the combination of the
types of variables (numbers and characters) passed into the method/function and the
type of information passed out of a method/function. For example, several
add methods
could be created—one that only accepts integers (whole numbers), one that only accepts
floating point numbers (numbers with decimals), and one that accepts a combination.
The program will determine which method/function to call by what has been passed into
the method/function. Inheritance in object-oriented programming allows an object to
inherit properties/variables and functions/methods from another object. The object can
also override those items inherited. This is similar to a child inheriting characteristics from
the parents. Object-oriented languages can also be event-driven. An event-driven program
will “sleep” until an event occurs. This is similar to an ATM machine program waiting for
a user to input an ATM card.
PHP is an open source language. As such, each version of the language is created using input from the
individuals who use it—the programmers themselves. This allows the language, over time, to evolve and
float into the direction that is driven by the users. From its first release in 1995 as a Personal Home Page Tool
(PHP) by Rasmus Lerdorf, the versions have been released on the Internet with forums to provide users the
ability to make suggestions and even provide code changes and additions. Today www.php.net is the official
PHP web site.
Open source language—An open source programming language is developed by a
community of interested parties. The community accepts input from fellow programmers
for suggested upgrades and corrections. Several members of the community work together
to present proposals and to make changes to the language. Open source languages are
“free”. A non-open source language (such as Microsoft C#) is created and updated by a
company or major organization. Non-open source languages are not usually “free”.
![](https://csdnimg.cn/release/download_crawler_static/10715969/bg14.jpg)
Chapter 1 ■ an IntroduCtIon to php 7
3
The www.php.net home page provides information on each of the latest releases of the language. It also
provides information on future releases, the features planned for those releases, and the planned release
dates. In addition, other related PHP information can be found, including links and information to major
PHP conferences.
Figure 1-1. PHP.NET (09/24/15)
Figure 1-2. Get involved (09/24/15)
www.allitebooks.com
剩余307页未读,继续阅读
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/694dad44b7c244158da6f17c2f00cf01_kernelkoder.jpg!1)
kernelkoder
- 粉丝: 57
- 资源: 317
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
最新资源
- 贵州煤矿矿井水分类与处理策略:悬浮物、酸性与非酸性
- 醛固酮增多症肾上腺静脉采样对比:ACTH后LR-CAV的最优评估
- 开源云连接传感器监控平台:农业土壤湿度远程监测
- 母婴用品企业年度生产计划线性规划优化模型:实证与应用
- 井下智能变电站:Rogowski线圈电流检测系统的研发与性能验证
- 霍州矿区煤巷稳定性分析及支护策略
- ARM嵌入式系统远程软件更新方案:基于TFTP协议
- 煤炭选煤中汞分布规律与洗选脱汞效果
- 提升码垛机器人性能:拉格朗日动力学模型与滑模模糊控制的应用
- 增强现实技术提升学前手写教学:设计与开发案例
- 不规则工作面沉陷三角剖分算法提升与应用
- 卡尔曼滤波在瞬变电磁干扰压制中的应用研究
- 煤矿安全能力研究:理论与系统构建
- LonWorks总线技术在斜巷运输车辆定位与跑车防护中的应用
- 神东煤炭集团高效煤粉锅炉系统:节能环保新实践
- Ti/SnO2+Sb2Ox/PbO2电极分形维数与电催化性能研究
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)