你好,是我琉忆。
一个文艺的PHP开发工程师。
很荣幸能够在这里带来我的第一本新书——《PHP程序员面试笔试宝典》。
一、创作过程
《PHP程序员面试笔试宝典》是我的第一本书,从写作到出来总共经历了一整年的时间。它就像我的孩子一样,十分的努力去创作,也十分的爱惜,创作实际用了3个月的时间,但是在长达审稿修改的时间却也用了3个月,剩余的3个月时间是出版社几个编辑在帮我审稿修改,对里面的字句进行斟酌跟我讨论修改。在此对他们的付出抱以诚挚真诚的感谢,谢谢你们的付出。
这本书是自己第一本出版的书,所以自己格外的爱惜它,也很怕这本书的内容不能满足大众,生怕被PHPer所嫌弃。在创作这本书的过程中,时常从读者的角度去审查它,它是否能够切实的在解答每道面试题上提供帮助,所涉及的知识点是否切实际的回答完善并且正确。并且我也知道自己的能力会有所欠缺,可能做得不够尽善尽美,但我也已经在此贡献了自己所能够达到最极致的能力去做好他。如果本书有所欠缺在此希望读者能够谅解,并可以对书中有所遗漏或不足之处给我写邮件进行指点,我将不断地对《PHP程序员面试笔试宝典》不断迭代完善,不断追求极致,帮助更多的PHPer面试成功。我的邮箱:330168885@qq.com(我的QQ:330168885),如果有什么事情也可以给我联系,我都愿意解答并且交流。感谢你,dear 读者。
二、我的书籍简介
本书主要针对 PHP 常考的知识点进行了梳理和整理,通过这些知识点,以点为面、全面系统地帮助读者发现自己的知识盲点,从而查漏补缺,帮助他们快速构建属于自己的 PHP 知识架构。由于这些知识点都是在笔试或面试的过程中经常遇到的,因此为了让读者能够更深入地理解这些相关的知识点,本书还在知识点的后面配上了相关的真题与解析,通过真题与解析加深读者的理解。
编者花费了几个月的时间,对 PHP 的知识点和各大互联网公司应用的技术和面试的问题
进行了深入了解。针对面试 PHP 岗位的常考考点,整理出这本《PHP 程序员面试笔试宝典》。
《PHP程序员面试笔试宝典》一本帮助程序员快速找到工作的书。
《PHP程序员面试笔试宝典》三、章节介绍
上篇:面试笔试经验技巧篇
想找到一份程序员的工作,一点技术都没有显然是不行的,但是,只有技术也是不够的。面试笔试经验技巧篇主要提供PHP程序员面试笔试经验、面试笔试问题方法讨论等。通过本篇的学习,求职者必将获取到丰富的应试技巧与方法。
下篇:面试笔试技术攻克篇
面试笔试技术攻克篇主要针对近3年以来近百家顶级IT企业的面试笔试真题而设计,这些企业涉及面非常广泛,面试笔试真题难易适中,非常具有代表性与参考性。本篇对这些真题以及其背后的知识点进行了深度剖析,并且对部分真题进行了庖丁解牛式的分析与讲解,针对真题中涉及的部分重难点问题,本篇都进行了适当的扩展与延伸,力求对知识点的讲解清晰而不紊乱,全面而不啰嗦,使得读者能够通过本书不仅获取到求职的知识,同时更有针对性地进行求职准备,最终能够收获一份满意的工作。
第1章 PHP基础知识
PHP也称为超文本预处理器,是一种开源的服务端脚本语言。目前,在全球拥有的100万站点中,有70%左右的站点是使用PHP开发的,PHP被广泛地应用于各种服务端前端及应用的开发。在面试笔试中PHP基础知识经常被考到,通过基础知识可以了解一个PHP程序员的功底如何。如果连PHP基础都没能掌握的人,那么很难在笔试中胜出。所以熟练地掌握PHP基础知识显得非常重要。这一章节将详细地介绍所有可能考到的PHP基础知识。
第2章PHP Web与框架
因为PHP是内嵌在Web的脚本语言,所以PHP和Web是分不开的。而为了避免因为PHP与Web代码的高度混杂在一起导致阅读性和维护性问题而产生了框架,合理地分开了前后端开发人员的工作。由于web和框架都是PHP开发中必不可少的东西,所以在面试中也是重要考点,作为开发者是必须熟练掌握各种主流的MVC框架的,因为在实际开发中经常用到。
第3章PHP进阶知识
本章主要针对PHP的时间和日期管理、缓存、文件、验证码等部分进行讲解。在一个项目的实际开发中,都需要涉及这些知识,它会穿插在整个项目中。在面试中问得比较多的是时间和缓存相关的问题,只要是涉及数据的存储都需要和时间打交道,而缓存是为了提高网站的打开速度而一定要使用的技术。
第4章 设计模式
无论是PHP还是Java,都时常会考到设计模式,了解透设计模式的人可以很快知道在什么场景下采用哪种代码的设计是合理的、稳定的、可扩展的,这样可以帮助团队在设计的前期减少问题的产生。而熟练掌握面向对象开发的人不一定懂得设计模式,但懂得设计模式的人可以熟练懂得面向对象,所以通过设计模式可以看出一个人对面向对象的掌握熟练程度,并且懂得设计模式的人还可以开发出一套模板或框架。对PHP程序员来说,因为设计模式是非常重要的,所以在面试中经常考到。
第5章 数据库
数据库是按照数据结构来组织、存储和管理数据的仓库。从最简单的存储各种数据的表格数据到如今进行海量数据存储都要用到数据库。PHP主要负责客户端和数据库的交互,随着用户访问一个网站的量的增加,PHP每次请求一次数据库都需要耗费内存和访问时间,从而加大服务器的压力和降低网页的访问速度。所以如今的公司都要求每个PHP开发人员需要懂得数据库的合理设计、优化。高并发访问的网站对数据库的设计维护要求更高,需要引入Memcache或Redis缓存来减少对数据库的请求,从而提高用户的访问速度。本章详细介绍MySQL的知识、优化和常考题目。
第6章 操 作 系 统
对于计算机系统而言,操作系统充当着基石的作用,它是连接计算机底层硬件与上层应用软件的桥梁,控制其他程序的运行,并且管理系统相关资源,同时提供配套的系统软件支持。对于专业的程序员而言,掌握一定的操作系统知识必不可少,因为不管面对的是底层嵌入式开发,还是上层的云计算开发,都需要使用到一定的操作系统相关知识。所以,对操作系统相关知识的考查是程序员面试笔试必考项之一。
第7章 网 络
在20世纪80年代,计算机网络诞生,它能够将一台台独立的计算机互相连接,使得位于不同地理位置的计算机之间可以进行通信,实现信息传递和资源共享,形成一组规模大、功能强的计算机系统。不过,计算机要想在网络中正常通信,必须遵守相关网络协议的规则,常用的网络协议有TCP、UDP、IP和HTTP等。
第8章 大数据
计算机硬件的扩容确实可以极大地提高程序的处理速度,但考虑到其技术、成本等方面的因素,它并非一条放之四海而皆准的途径。而随着互联网技术的发展,云计算、物联网、移动通信技术的兴起,每时每刻,数以亿计的用户产生着数量巨大的信息,海量数据时代已经来临。由于通过对海量数据的挖掘能有效地揭示用户的行为模式,加深对用户需求的理解,提取用户的集体智慧,从而为研发人员决策提供依据,提升产品用户体验,进而占领市场,所以当前各大互联网公司都将研究重点放在了海量数据分析上,但是,只寄希望于硬件扩容是很难满足海量数据分析需要的,如何利用现有条件进行海量信息处理已经成为各大互联网公司亟待解决的问题。所以,海量信息处理正日益成为当前程序员笔试面试中一个新的亮点。
四、宝典的目录
《PHP 程序员面试笔试宝典》整本书涵盖的知识目录包括:面试经验技巧、PHP常考基础知识、PHP面向对象和设计模式的知识点、PHP进阶知识、数据库常考的MySQL的知识点、计算机网络相关的知识点,除此之外还额外增加了操作系统的常考知识,和常考的大数据知识点等。帮助每个PHP程序员面试更顺利。
整本书的目录:
上篇:面试笔试经验技巧篇
经验技巧1 如何巧妙地回答面试官的问题······································································· 2
经验技巧2 如何回答技术性的问题················································································· 3
经验技巧3 如何回答非技术性问题················································································· 4
经验技巧4 如何回答快速估算类问题·············································································· 5
经验技巧5 如何回答算法设计问题················································································· 6
经验技巧6 如何回答系统设计题···················································································· 8
经验技巧7 如何解决求职中的时间冲突问题·································································· 11
经验技巧8 如果面试问题曾经遇见过,是否要告知面试官·············································· 12
经验技巧9 在被企业拒绝后是否可以再申请·································································· 12
经验技巧10 如何应对自己不会回答的问题··································································· 13
经验技巧11 如何应对面试官的“激将法”语言····························································· 13
经验技巧12 如何处理与面试官持不同观点这个问题······················································ 14
经验技巧13 什么是职场暗语······················································································· 14
经验技巧14 如何进行自我介绍?················································································· 18
经验技巧15 如何克服面试中紧张的情绪?··································································· 19
经验技巧16 如何准备集体面试?················································································· 21
经验技巧17 如何准备电话面试?················································································· 23
经验技巧18 签约和违约需要注意哪些事情?································································ 24
下篇:面试笔试技术攻克篇
第1章 PHP基础知识································································································· 29
1.1 PHP语言········································································································· 29
1.1.1 PHP与ASP、JSP有什么区别?···································································· 29
1.1.2 PHP与HTML有什么区别?········································································· 31
1.1.3 PHP的优点是什么?··················································································· 32
1.1.4 PHP的输出语句有哪些?············································································· 33
1.1.5 如何区分单引号与双引号?·········································································· 35
1.1.6 什么是XML?··························································································· 37
1.2 面向对象技术··································································································· 40
1.2.1 面向对象与面向过程有什么区别?································································· 40
1.2.2 面向对象的特征是什么?············································································· 41
1.2.3 面向对象的开发方式有什么优点?································································· 41
1.2.4 类与对象的区别是什么?············································································· 41
1.2.5 PHP5 中魔术方法有哪些?··········································································· 43
1.2.6 值传递与引用传递有什么区别?···································································· 51
1.2.7 什么是对象克隆?······················································································ 52
1.2.8 什么是延迟静态绑定?················································································ 56
1.2.9 作用域范围有哪几种?················································································ 57
1.2.10 什么是构造函数?什么是析构函数?···························································· 58
1.2.11 什么是继承?·························································································· 60
1.2.12 抽象类与接口有什么区别与联系?································································ 63
1.2.13 什么是多态?·························································································· 65
1.3 关键字············································································································· 67
1.3.1 final有什么作用?······················································································ 67
1.3.2 finally有什么作用?··················································································· 68
1.3.3 assert有什么作用?···················································································· 69
1.3.4 static有什么作用?····················································································· 70
1.3.5 global有什么作用?···················································································· 72
1.3.6 this、self和parent的区别是什么?································································· 73
1.3.7 include与require有什么区别?······································································ 75
1.3.8 break、continue与return有什么区别与联系?··················································· 77
1.3.9 switch有什么作用?··················································································· 79
1.4 常量与变量······································································································ 81
1.4.1 什么是常量?···························································································· 81
1.4.2 什么是变量?···························································································· 84
1.4.3 如何判断变量是否存在、是否为非空字符或非零?············································ 87
1.4.4 变量的作用域范围有哪几种?······································································· 87
1.4.5 如何对变量进行引用?················································································ 89
1.5 数据类型········································································································· 90
1.5.1 基本数据类型有哪些?················································································ 90
1.5.2 如何进行类型转换?··················································································· 92
1.6 运算符············································································································· 93
1.6.1 运算符的种类有哪些?················································································ 93
1.6.2 ++与—的含义是什么?·············································································· 100
1.7 字符串··········································································································· 101
1.7.1 字符串处理函数有哪些?··········································································· 101
1.7.2 ==与===有什么区别?··············································································· 106
1.8 正则表达式···································································································· 106
1.9 函数·············································································································· 111
1.9.1 传值和引用的区别是什么?········································································ 111
1.9.2 什么是默认参数?···················································································· 114
1.9.3 什么是函数返回值?················································································· 114
1.9.4 如何进行函数调用?················································································· 115
1.10 数组············································································································ 117
1.10.1 如何进行数组的定义与声明?···································································· 117
1.10.2 什么是多维数组?··················································································· 121
1.10.3 数组函数有哪些?··················································································· 124
1.11 文件管理······································································································ 130
1.11.1 有哪些文件操作?···················································································· 130
1.11.2 涉及文件操作的函数有哪些?···································································· 134
1.12 异常处理与错误处理····················································································· 137
1.12.1 什么是异常处理与错误处理?···································································· 137
1.12.2 error_reporting()的作用是什么?································································· 138
1.12.3 如何进行异常捕捉与处理?······································································· 139
1.12.4 如何实现自定义的异常类?······································································· 141
1.13 内存管理······································································································ 141
1.13.1 什么是内存管理?··················································································· 141
1.13.2 什么是垃圾回收?··················································································· 142
1.14 Redis············································································································ 143
1.14.1 什么是Redis?······················································································· 143
1.14.2 Redis的常见问题有哪些?········································································ 145
1.15 Memcache····································································································· 147
第2章 PHP Web与框架··························································································· 153
2.1 PHP Web········································································································ 153
2.1.1 Session与Cookie的区别是什么?································································ 153
2.1.2 GET和POST有什么区别?········································································ 158
2.1.3 如何预防各类安全性问题?········································································ 160
2.1.4 HTTP状态码的含义是什么?······································································ 161
2.1.5 utf-8编码需要注意哪些问题?····································································· 164
2.1.6 如何进行网站的优化?·············································································· 165
2.2 模板·············································································································· 166
2.3 框架·············································································································· 167
2.3.1 什么是MVC?························································································· 167
2.3.2 PHP的开发框架有哪些?··········································································· 168
2.3.3 什么是CI框架?······················································································ 168
2.4 JavaScript、HTML、CSS等············································································· 171
第3章 PHP进阶知识······························································································· 173
3.1 时间和日期管理······························································································ 173
3.1.1 如何输出年-月-日?················································································· 173
3.1.2 如何输出时-分-秒?················································································· 174
3.1.3 如何输出闰年-星期-天?··········································································· 175
3.1.4 PHP相关的日期函数有哪些?····································································· 176
3.2 缓存·············································································································· 179
3.3 文件管理········································································································ 180
3.3.1 PHP中文件操作函数有哪些?····································································· 180
3.3.2 如何进行文件上传?················································································· 183
3.3.3 如何进行文件下载?················································································· 185
3.3.4 如何进行版本管理?················································································· 186
3.4 验证码··········································································································· 187
第4章 设计模式········································································································· 188
4.1 常见的设计模式有哪些?················································································ 188
4.2 什么是单例模式?·························································································· 190
4.3 什么是工厂模式?·························································································· 191
4.4 什么是观察者模式?······················································································· 192
第5章 数据库············································································································ 196
5.1 数据库基础知识······························································································ 196
5.1.1 SQL语言的功能有哪些?··········································································· 197
5.1.2 内连接与外连接有什么区别?····································································· 199
5.1.3 什么是事务?·························································································· 200
5.1.4 什么是存储过程?它与函数有什么区别与联系?·············································· 202
5.1.5 一二三四范式有何区别?··········································································· 202
5.1.6 什么是触发器?······················································································· 204
5.1.7 什么是游标?·························································································· 205
5.1.8 如果数据库日志满了,那么会出现什么情况?················································· 206
5.1.9 UNION和UNION ALL有什么区别?··························································· 206
5.1.10 什么是视图?························································································· 207
5.1.11 什么是数据库三级封锁协议?···································································· 207
5.1.12 索引的优缺点························································································· 208
5.2 MySQL基础知识···························································································· 209
5.2.1 PHP操作MySQL的函数有哪些?································································ 210
5.2.2 PHP连接MySQL的方法是什么?································································ 211
5.2.3 MySQLi访问数据库的方法········································································· 214
5.2.4 如何进行MySQL操作?············································································ 218
5.2.5 MySQL支持哪些字段类型?······································································· 227
5.2.6 什么是索引?·························································································· 230
5.2.7 什么是数据库引擎?················································································· 232
5.2.8 如何进行数据库分页?·············································································· 233
5.2.9 什么是数据库权限?················································································· 237
5.2.10 PHP Web访问MySQL方法是什么?··························································· 238
5.2.11 如何高效操作MySQL?··········································································· 240
5.3 MySQL高级管理···························································································· 240
5.3.1 如何对MySQL进行优化?········································································· 240
5.3.2 如何进行数据库优化?·············································································· 244
5.3.3 如何进行数据库操作优化?········································································ 247
5.3.4 如何进行数据库表优化?··········································································· 249
第6章 操作系统······································································································· 255
6.1 进程管理········································································································ 255
6.1.1 进程与线程有什么区别?··········································································· 255
6.1.2 线程同步有哪些机制?·············································································· 256
6.1.3 内核线程和用户线程的区别········································································ 256
6.2 内存管理········································································································ 257
6.2.1 内存管理有哪几种方式?··········································································· 257
6.2.2 什么是虚拟内存?···················································································· 258
6.2.3 什么是内存碎片?什么是内碎片?什么是外碎片?··········································· 258
6.2.4 虚拟地址、逻辑地址、线性地址、物理地址有什么区别?·································· 259
6.2.5 Cache替换算法有哪些?············································································ 259
6.3 用户编程接口································································································· 261
6.3.1 库函数调用与系统调用有什么不同?····························································· 261
6.3.2 静态链接与动态链接有什么区别?······························································· 261
6.3.3 静态链接库与动态链接库有什么区别?·························································· 262
6.3.4 用户态和核心态有什么区别?····································································· 262
6.3.5 用户栈与内核栈有什么区别?····································································· 263
第7章 网络·············································································································· 264
7.1 TCP/IP··········································································································· 264
7.1.1 协议······································································································ 264
7.1.2 TCP/IP··································································································· 265
7.1.3 常见笔试题····························································································· 265
7.2 RESTful架构风格··························································································· 266
7.2.1 REST····································································································· 266
7.2.2 约束条件································································································ 267
7.2.3 常见笔试题····························································································· 267
7.3 HTTP············································································································ 268
7.3.1 URI和URL···························································································· 268
7.3.2 HTTP协议······························································································ 269
7.3.3 HTTP报文······························································································ 271
7.3.4 HTTP首部······························································································ 272
7.3.5 缓存······································································································ 273
7.3.6 常见笔试题····························································································· 275
7.4 TCP··············································································································· 276
7.4.1 连接管理································································································ 276
7.4.2 确认应答································································································ 278
7.4.3 窗口控制································································································ 280
7.4.4 重传控制································································································ 281
7.4.5 常见笔试题····························································································· 281
7.5 HTTPS··········································································································· 282
7.5.1 加密······································································································ 283
7.5.2 数字签名································································································ 283
7.5.3 数字证书································································································ 284
7.5.4 安全通信机制·························································································· 284
7.5.5 常见笔试题····························································································· 286
7.6 HTTP/2.0······································································································· 286
7.6.1 二进制分帧层·························································································· 287
7.6.2 多路通信································································································ 288
7.6.3 请求优先级····························································································· 288
7.6.4 服务器推送····························································································· 289
7.6.5 首部压缩································································································ 289
7.6.6 常见笔试题····························································································· 289
第8章 大数据·········································································································· 290
8.1 从大量的URL中找出相同的URL···································································· 290
8.2 求高频词········································································································ 290
8.3 找出访问百度最多的IP··················································································· 291
8.4 在大量的数据中找出不重复的整数··································································· 292
8.5 在大量的数据中判断一个数是否存在································································ 292
8.6 如何查询最热门的查询串················································································ 293
8.7 统计不同电话号码的个数················································································ 294
8.8 从5亿个数中找出中位数················································································ 295
8.9 按照query的频度排序···················································································· 296
8.10 找出排名前500的数····················································································· 297
附录 真题及答案······································································································· 298
真题1··················································································································· 298
真题2··················································································································· 300
真题3··················································································································· 303
真题1答案············································································································ 305
真题2答案············································································································ 306
真题3答案············································································································ 308
五、由衷的感谢
作者本名刘恒春,笔名琉忆,在这里最先感谢的是大神何昊和薛鹏给予的这个机会,让我有机会参与PHP相关的面试书籍的创作,其次感谢机械工业出版社给予的出版机会。最后由衷的感谢支持我的父母、哥哥姐姐,还有我的朋友,是你们的支持才让我最终得以完成这本书。还有为了这本宝典默默付出审稿的幕后工作者们,非常感谢你们,你们辛苦了。
在此对以上帮助过我得以出版PHP面试宝典的人说声谢谢,非常感谢。
最后由衷的感谢每一位读者,谢谢你们对本书的支持。
宝典下载路径:宝典网盘下载
网友评论