2021PHP经典面试题汇总,包括PHP基础部分、数据库部分、面向对象部分、ThinkPHP部分部分、smarty模板引擎、二次开发系统(DEDE、ecshop)、微信公众平台开发、对于自身掌握的技术描述等几部分PHP面试题。
2021 PHP Classic interview issues summary, including PHP Foundation, Database Section, Object-oriented Part, ThinkPHP Part, smarty template engine, secondary development system (DEDE, ecshop), development of the CVP Platform, description of the technology in its possession, etc.
源码分享:http://github.crmeb.net/u/defu
更新日期:2021年02月06日
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210409092620307.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM5MjIxNDM2,size_16,color_FFFFFF,t_70)
Date of update: 06/02/02/04/02
! [Photo description inserted here] (https://img-blog.csdnimg.cn/20209092620307.png?x-oss-process=image/watermark, type_ZmFuZ3poZW5naGVpdGk, shadow_10, text_aHR0-M6Ly9ibnnlmNzZubmV0L3FxzM5MjIxNDM2 size_16, color_FFM_70)
2021PHP经典面试题汇总大全
目录:
一:PHP基础部分
二:数据库部分
三:面向对象部分
四:ThinkPHP部分
五:smarty模板引擎
六、二次开发系统(DEDE、ecshop)
七、微信公众平台开发
八、对于自身掌握的技术描述
2021 PHP Classic interview issues summarized in
Catalogue:
I: PHP Foundation
II: Database Part
III: Object-oriented Part
IV: ThinkPHP Part
V: Smarty Template Engine
VI, Secondary Development System (DEDE, ecshop)
VII, Development of Micro-Credit Public Platforms
VIII, description of technology in their possession
一:PHP基础部分
返回顶部
I: PHP Foundation
returns to the top
1、PHP语言的一大优势是跨平台,什么是跨平台?
PHP的运行环境最优搭配为Apache+MySQL+PHP,此运行环境可以在不同操作系统(例如windows、Linux等)上配置,不受操作系统的限制,所以叫跨平台
One of the main advantages of the PHP language is the cross-platform, and what is the cross-platform?
PHP operates with an optimal mix of Apache+MySQL+PHP, which can be configured on different operating systems (e.g. Windows, Linux, etc.) and is therefore called the cross-platform.
2、WEB开发中数据提交方式有几种?有什么区别?百度使用哪种方式?
Get与post两种方式
区别:
1. Get从服务器获取数据,post向服务器传送数据
2. Get传值在url中可见,post在url中不可见
3. Get传值一般在2KB以内,post传值大小可以在php.ini中进行设置
4. get安全性非低,post安全性较高,执行效率却比Post高
建议:
1、get式安全性较Post式要差些包含机密信息建议用Post数据提交式;
2、做数据查询建议用Get式;做数据添加、修改或删除建议用Post方式;
百度使用的get方式,因为可以从它的URL中看出
How can data be submitted in the WEB development? What is the difference?
Get and post are used differently:
1. Get access to data from the server, post transmits data to the server
2. Get fax values in url are not available in
3. Get fax values are generally within 2 kB, post-sizes can be set in php.ini
4. get safety is not low, post security is higher, implementation is more efficient than Post
recommendations:
1, the get security is less than the Post type suggests to include classified data submissions;
2, data queries are recommended in Get; data additions, modifications or deletions are recommended in Post mode;
centiles are visible in its URLs.
PHP面试题库网盘下载
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210409092738562.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM5MjIxNDM2,size_16,color_FFFFFF,t_70)
PHP interview library disk downloads
! [Pocket image description is inserted here] (https://img-blog.csdnimg.cn/20209092738562.png?x-oss-process=image/watermark, type_ZmFuZ3poZW5GVpdGk, shadow_10, text_aHR0-M6Ly9ibnLmzZ4ubmV0L3FxXM5MjIxNDM2, size_16, color_FF(T_70)
题库大全下载:[PHP面试题汇总大全网盘下载](http://www.phpmianshiti.com/xiazai/)
(http://www.phpmianshiti.com/xiazai/)
3、掌握PHP的哪些框架、模板引擎、系统等
框架:框架有很多,例如zendframe、CI、Yii等等,咱们学过的是thinkphp
模板引擎:也有很多,在课本中有,咱们学过的是smarty
系统:有很多,例如:康盛的产品(uchome、supesite、discuzX等),帝国系统、DEDE(织梦)、ecshop等,咱们学过的是DEDECMS、Ecshop
3; what framework, template engines, systems, etc. of the PHP are
framework: there are many frameworks, such as zendframe, CI, Yii, etc., we've learned the thinkphp
template engine: there are many, and in textbooks we've learned the smarty br: there are many, such as: uchome, supeseite, discuzX, imperial systems, DECE (weaving dreams), ecshop, etc., we've learned DECMS, Ecshop, etc.
4、说一下你所掌握的网页前端技术有哪些?
熟练掌握DIV+CSS网页布局,JavaScript、jQuery框架、photoshop图片处理
4. What's your front-end technology?
is good at DIV+CS, JavaScript, jQuery framework, photoshop photo processing.
5、AJAX的优势是什么?
ajax是异步传输技术,可以通过javascript实现,也可以通过JQuery框架实现,实现局部刷新,减轻了服务器的压力,也提高了用户体验
What's the advantage of AJAX?
ajax is an astrotransmission technology that can be achieved through javascript or through the JQuery framework, which allows for local refreshing, reduces server pressure and enhances user experience.
6、安全对一套程序来说至关重要,请说说在开发中应该注意哪些安全机制?
①防远程提交;②防SQL注入,对特殊代码进行过滤;③防止注册机灌水,使用验证码;
6. Safety is essential to a set of procedures. Please indicate which security mechanisms should be noted in the development?
1 to prevent remote submission; 2 to prevent SQL injection and filtering of special codes; 3 to prevent registration machines from filling water and using certification codes;
7、在程序的开发中,如何提高程序的运行效率?
①优化SQL语句,查询语句中尽量不使用select *,用哪个字段查哪个字段;少用子查询可用表连接代替;少用模糊查询;②数据表中创建索引;③对程序中经常用到的数据生成缓存;
7. How to improve the efficiency of the operation of the program in the development of the program?
1 optimizes the SQL statement, using as much as possible the select * in the query statement and identifying which fields in which field to use; replaces by less sub-checking with table connections; less vague queries; 2 creating indexes in the data table; 3 generating caches of data frequently used in the process;
8、PHP可否与其它的数据库搭配使用?
PHP与MYSQL数据库是最优搭配,当然PHP也可以去其它的数据库搭配使用,例如MSSQL等,PHP中预留了操作MSSQL的函数,只要开启就可以使用
8. Could PHP be used in combination with other databases?
PHP and MYSQL databases are best matched. Of course, PHP can be used in combinations with other databases, such as MSSQL, where functions for operating MSSQL are reserved and can be used as long as they are turned on
9、现在编程中经常采取MVC三层结构,请问MVC分别指哪三层,有什么优点?
MVC三层分别指:业务模型、视图、控制器,由控制器层调用模型处理数据,然后将数据映射到视图层进行显示,优点是:①可以实现代码的重用性,避免产生代码冗余;②M和V的实现代码分离,从而使同一个程序可以使用不同的表现形式
9- What are the advantages of the three layers of MVC, which are often used in programming?
MVC, which refers to business models, views, controllers, which are called by the control layer to process the data, and then map the data to the view layer. The advantages are: 1 can be used to re-use the code and avoid creating redundancies; 2M and V can be separated so that the same program can use different expressions.
10、对json数据格式的理解?
JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,json数据格式固定,可以被多种语言用作数据的传递
PHP中处理json格式的函数为json_decode( string $json [, bool $assoc ] ) ,接受一个 JSON格式的字符串并且把它转换为PHP变量,参数json待解码的json string格式的字符串。assoc当该参数为TRUE时,将返回array而非object;
Json_encode:将PHP变量转换成json格式
10, Understanding a json data format?
JSON (JavaScript Object Note) is a lightweight data exchange format, and json data formats are fixed and can be used in multiple languages for data transmission
PHP The function for processing json formats is json_decode (string US$json [, bool US$assoc]]), accepting a string in a JSON format and converting it to a PHP variable, and the parameter json string in which the json string is to be decoded. Assoc returns the string instead of object when the parameter is TRUE;
Json_encode: Converting the PHP variable into a json format
11、Print、echo、print_r有什么区别?
① echo和print都可以做输出,不同的是,echo不是函数,没有返回值,而print是一个函数有返回值,所以相对而言如果只是输出echo会更快,而print_r通常用于打印变量的相关信息,通常在调试中使用。
② print 是打印字符串
③ print_r 则是打印复合类型 如数组 对象
What difference does it make?
1 root and print_r can do output, unlike when the function is not a function and the value is not returned, and the function is a function has a return value, so it's faster if it's just a function, and the information that print_r usually uses to print variables is usually used in deburetation.
2 print string
3 print_r is a print complex type such as array objects
12、SESSION与COOKIE的区别?
①存储位置:session存储于服务器,cookie存储于浏览器
②安全性:session安全性比cookie高
③session为‘会话服务’,在使用时需要开启服务,cookie不需要开启,可以直接用
12, the difference between SESION and COOKIE?
1 storage location: session stored on the server, cookie stored on the browser
2 security: session security is higher than cookies
3session for `meeting service', needs to be opened when used, cookies do not need to be opened and can be used directly
13、PHP处理数组的常用函数?(重点看函数的‘参数’和‘返回值’)
①array()创建数组;②count()返回数组中元素的数目;③array_push()将一个或多个元素插入数组的末尾(入栈);④array_column()返回输入数组中某个单一列的值;⑤array_combine()通过合并两个数组来创建一个新数组;⑥array_reverse()以相反的顺序返回数组;⑦array_unique()删除数组中的重复值;⑧in_array()检查数组中是否存在指定的值;
13, a commonly used function of PHP to process arrays? (focus on `parameters' and `return values' of the function)
1array() creates arrays; 2 Count() returns the number of elements in arrays; 3array_push() inserts one or more elements into the end of arrays (tocking); 4rray_collumn() returns the value of a single column in the input array; 5rray_combine() creates a new array by combining two arrays; 6rray_reverse() returns the array in a reverse order; 7rray_unique() removes the duplicate value in array; 8in_array() inspects the existence of a specified value in the array;
14、PHP处理字符串的常用函数?(重点看函数的‘参数’和‘返回值’)
①trim()移除字符串两侧的空白字符和其他字符;
②substr_replace()把字符串的一部分替换为另一个字符串;
③substr_count()计算子串在字符串中出现的次数;
④substr()返回字符串的一部分;
⑤strtolower()把字符串转换为小写字母;
⑥strtoupper()把字符串转换为大写字母;
⑦strtr()转换字符串中特定的字符;
⑧strrchr()查找字符串在另一个字符串中最后一次出现;
⑨strstr()查找字符串在另一字符串中的第一次出现(对大小写敏感);strrev()反转字符串;strlen()返回字符串的长度;str_replace()替换字符串中的一些字符(对大小写敏感);print()输出一个或多个字符串;explode()把字符串打散为数组;is_string()检测变量是否是字符串;strip_tags()从一个字符串中去除HTML标签;mb_substr()用来截中文与英文的函数
14, commonly used functions of PHP processing strings? (focus on `parameters' and `return values' of the function)
1trim() removes blank characters and other characters on both sides of the string;
2substr_replace() replaces part of the string with another string;
3substr_count() calculates the number of times in the string;
4substr() returns part of the string;
5strtolower() converts the string to lower letter;
6strupper() converts the string to upper letter;
7strtr() converts a specific character in the string;
8strchr() find the string for the last time in the other string;
9strstror() search whether the string appears for the first time in the other string (sensitically sensitive); strev(s) reverse; strlen(s) returns the string(s) (s) strint(s) is used as a single string (s) of a single string (s)
15、PHP处理时间的常用函数?(重点看函数的‘参数’和‘返回值’)
date_default_timezone_get()返回默认时区。
date_default_timezone_set()设置默认时区。
date()格式化本地时间/日期。
getdate()返回日期/时间信息。
gettimeofday()返回当前时间信息。
microtime()返回当前时间的微秒数。
mktime()返回一个日期的 Unix时间戳。
strtotime()将任何英文文本的日期或时间描述解析为 Unix时间戳。
time()返回当前时间的 Unix时间戳。
15, a common function of PHP processing time? (Effort focus on function `parameter' and `return value')
date_default_timeone_get() returns the default time zone.
date_default_timeone_set() sets the default time zone.
date() formats local time/date.
getdate() returns date/time information.
gettimeofday() returns the current time information.
microtime() returns the number of seconds of the current time.
mktime() returns the Unix time stamp of a date.
strectime() interprets any English text as Unix time stamp.
setme() returns the Unix time stamp of the current time.
16、PHP处理数据库的常用函数?(重点看函数的‘参数’和‘返回值’)
请参照php手册,认真查看,此项非常重要
16, commonly used functions of PHP processing databases? (Specify `parameters' and `return values' of functions)
See the php manual carefully. This is very important.
17、PHP操作文件的常用函数?(重点看函数的‘参数’和‘返回值’)
①打开文件;②删除文件;③读取文件;④写入文件;⑤修改文件;⑥关闭文件;⑦创建文件等等,此项非常重要,在工作中经常用来生成缓存或者静态文件,请参照php手册,认真查看
17, the usual function of the PHP operating file? (Focus `parameters' and `return values' of the function)
1 opens the file; 2 deletes the file; 3 reads the file; 4 writes the file; 5 changes the file; 6 closes the file; 7 creates the file, etc., which is very important and is often used to generate caches or static files in the work. See the php manual for careful viewing.
18、PHP操作目录(文件夹)的常用函数?(重点看函数的‘参数’和‘返回值’)
①打开目录;②删除目录;③读取目录;④创建目录;⑤修改目录;⑥关闭目录等等,此项非常重要,在工作中经常用来创建或者删除上传文件的目录,创建或者删除缓存、静态页面的目录,请参照php手册,认真查看
18, a common function of the PHP operating directory (folders)? (focus on `parameters' and `return values' of the function)
1 opens the directory; 2 deletes the directory; 3 reads the directory; 4 creates the directory; 5 changes the directory; 6 closes the directory, etc., which is very important and is often used in the work to create or delete directories for uploading files, create or delete directories for caches, static pages. See the php manual for careful viewing.
二:数据库部分
返回顶部
II: The database section
returns to the top
1. 常见的关系型数据库管理系统产品有?
答:Oracle、SQL Server、MySQL、Sybase、DB2、Access等。
Common relationship database management system products are:
Answers: Oracle, SQL Server, MySQL, Sybase, DB2, Access, etc.
2. SQL语言包括哪几部分?每部分都有哪些操作关键字?
答:SQL语言包括数据定义(DDL)、数据操纵(DML),数据控制(DCL)和数据查询(DQL)四个部分。
数据定义:Create Table,Alter Table,Drop Table, Craete/Drop Index等
数据操纵:Select ,insert,update,delete,
数据控制:grant,revoke
数据查询:select
What parts of SQL language do you have?
Answer: SQL language includes data definition (DDL), data manipulation (DML), data control (DCL) and data query (DQL) four parts.
Data definition: Create Table, Alter Table, Drop Table, Crae/Drop Index and others
Data manipulation: Select, insert,update,delete,
Data control: Grant,revoke
Data query: Select
3. 完整性约束包括哪些?
答:数据完整性(Data Integrity)是指数据的精确(Accuracy)和可靠性(Reliability)。
分为以下四类:
1) 实体完整性:规定表的每一行在表中是惟一的实体。
2) 域完整性:是指表中的列必须满足某种特定的数据类型约束,其中约束又包括取值范围、精度等规定。
3) 参照完整性:是指两个表的主关键字和外关键字的数据应一致,保证了表之间的数据的一致性,防止了数据丢失或无意义的数据在数据库中扩散。
4) 用户定义的完整性:不同的关系数据库系统根据其应用环境的不同,往往还需要一些特殊的约束条件。用户定义的完整性即是针对某个特定关系数据库的约束条件,它反映某一具体应用必须满足的语义要求。
与表有关的约束:包括列约束(NOT NULL(非空约束))和表约束(PRIMARY KEY、foreign key、check、UNIQUE) 。
2) Area integrity: refers to the column in the table that must satisfy a particular type of data constraint, which includes a range of values, accuracy, etc.
3) Reference integrity: refers to the consistency of data between the primary and extra-key characters of the two tables, which ensures consistency of data between the tables and prevents the dissemination of lost or meaningless data in the database.
4) Completeness of user definitions: Different relationship database systems, depending on the environment in which they are applied, often also require special constraints. The completeness of user definitions is defined as the binding conditions for a particular relationship database, which also includes the range of values, accuracy, etc.
3) Reference integrity: refers to the consistency of data between the primary and extra-key characters of the two tables, which ensures consistency of data between the tables and prevents the spread of data in the database.
) The integrity of user definitions: Different relationship database systems, depending on the environment in which they are applied, often requires a number of constraints.
4. 什么是事务?及其特性?
答:事务:是一系列的数据库操作,是数据库应用的基本逻辑单位。
事务特性:
(1)原子性:即不可分割性,事务要么全部被执行,要么就全部不被执行。
(2)一致性或可串性。事务的执行使得数据库从一种正确状态转换成另一种正确状态
(3)隔离性。在事务正确提交之前,不允许把该事务对数据的任何改变提供给任何其他事务,
(4) 持久性。事务正确提交后,其结果将永久保存在数据库中,即使在事务提交后有了其他故障,事务的处理结果也会得到保存。
或者这样理解:
事务就是被绑定在一起作为一个逻辑工作单元的SQL语句分组,如果任何一个语句操作失败那么整个操作就被失败,以后操作就会回滚到操作前状态,或者是上有个节点。为了确保要么执行,要么不执行,就可以使用事务。要将有组语句作为事务考虑,就需要通过ACID测试,即原子性,一致性,隔离性和持久性。
What is the matter?
Answer: Matters: A series of database operations are the basic logical units for the application of the database.
The service characteristics:
(1) Atomism: Indivisibility, where the matter is either fully executed or not implemented.
(2) Consistency or collusiveness. The execution of the transaction allows the database to be converted from one correct state to another
5. 什么是锁?
答:数据库是一个多用户使用的共享资源。当多个用户并发地存取数据时,在数据库中就会产生多个事务同时存取同一数据的情况。若对并发操作不加控制就可能会读取和存储不正确的数据,破坏数据库的一致性。
加锁是实现数据库并发控制的一个非常重要的技术。当事务在对某个数据对象进行操作前,先向系统发出请求,对其加锁。加锁后事务就对该数据对象有了一定的控制,在该事务释放锁之前,其他的事务不能对此数据对象进行更新操作。
基本锁类型:锁包括行级锁和表级锁
What's a lock?
answer: The database is a multi-user shared resource. When multiple users access data simultaneously, multiple transactions will occur in the database to access the same data at the same time. If there is no control over simultaneous operations, reading and storing incorrect data may undermine the consistency of the database.
6. 什么叫视图?游标是什么?
答:视图是一种虚拟的表,具有和物理表相同的功能。可以对视图进行增,改,查,操作,视图通常是有一个表或者多个表的行或列的子集。对视图的修改不影响基本表。它使得我们获取数据更容易,相比多表查询。
游标:是对查询出来的结果集作为一个单元来有效的处理。游标可以定在该单元中的特定行,从结果集的当前行检索一行或多行。可以对结果集当前行做修改。一般不使用游标,但是需要逐条处理数据的时候,游标显得十分重要。
What is the view? What is the cursor?
Answer: The view is a virtual table with the same function as the physical table. It can be increased, modified, checked, operated, usually with a subset of rows or columns of one or more tables. The changes to the view do not affect the basic table. It makes it easier for us to get data, compared to multiple tabs.
Curtains: is an effective treatment of the search results set as a unit. The cursor can be assigned to a particular line in the module and retrieve one or more rows from the current row in the result set. It can be modified for the current row in the result set.
7. 什么是存储过程?用什么来调用?
答:存储过程是一个预编译的SQL语句,优点是允许模块化的设计,就是说只需创建一次,以后在该程序中就可以调用多次。如果某次操作需要执行多次SQL,使用存储过程比单纯SQL语句执行要快。可以用一个命令对象来调用存储过程。
What is the storage process? What is called?
Answer: The storage process is a pre-edited SQL statement, which has the advantage of allowing modular design, i.e. it can be created only once and then called several times in the process. If a single operation requires multiple SQLs, the storage process is executed faster than a simple SQL statement. A command object can be used to call the storage process.
8. 索引的作用?和它的优点缺点是什么?
答:索引就一种特殊的查询表,数据库的搜索引擎可以利用它加速对数据的检索。它很类似与现实生活中书的目录,不需要查询整本书内容就可以找到想要的数据。索引可以是唯一的,创建索引允许指定单个列或者是多个列。缺点是它减慢了数据录入的速度,同时也增加了数据库的尺寸大小。
What is the role of the index? And what are its strengths?
Answer: The index is a special search table, which can be used by the search engine of the database to speed up the search for data. It is similar to a directory of books in real life and can find the desired data without having to search for the contents of the entire book. The index can be the only one, creating an index that allows for the assignment of individual columns or multiple columns. The disadvantage is that it slows data entry and increases the size of the database.
9. 如何通俗地理解三个范式?
答:第一范式:1NF是对属性的原子性约束,要求属性具有原子性,不可再分解;
第二范式:2NF是对记录的惟一性约束,要求记录有惟一标识,即实体的惟一性; 第三范式:3NF是对字段冗余性的约束,即任何字段不能由其他字段派生出来,它要求字段没有冗余。。
9. How can three paradigms be understood in general terms?
Answers: first paradigm: NF is an atomic constraint on properties, requiring properties to be atomic and non-dissoluble; second paradigm:
is the sole constraint on records, requiring records to be uniquely marked, i.e. physical uniqueness; third paradigm: NF is a constraint on field redundancy, i.e. no field can be derived from other fields, and it requires that fields be free of redundancy.
10. 什么是基本表?什么是视图?
答:基本表是本身独立存在的表,在 SQL 中一个关系就对应一个表。 视图是从一个或几个基本表导出的表。视图本身不独立存储在数据库中,是一个虚表
What is the basic table? What is the view?
Answer: The basic table is a self-contained table, and a relationship in SQL corresponds to a table. The view is a table derived from one or several basic tables. The view itself is not stored independently in the database.
11. 试述视图的优点?
答:(1) 视图能够简化用户的操作 (2) 视图使用户能以多种角度看待同一数据; (3) 视图为数据库提供了一定程度的逻辑独立性; (4) 视图能够对机密数据提供安全保护。
Advantages of the recapitulation view?
answer: (1) The view can simplify user operations (2) The view allows users to view the same data from multiple angles; (3) The view provides a degree of logical independence for the database; (4) The view can provide security for confidential data.
12. NULL是什么意思
答:NULL这个值表示UNKNOWN(未知):它不表示“”(空字符串)。对NULL这个值的任何比较都会生产一个NULL值。您不能把任何值与一个 NULL值进行比较,并在逻辑上希望获得一个答案。
使用IS NULL来进行NULL判断
NULL means
answer: NULL this value means UNKNOWN (unknown): it does not mean " (empty string). Any comparison of NULL this value produces a NUL value. You cannot compare any value to a NULL value and logically want an answer.
uses ISNULL for NULL judgement.
13. 主键、外键和索引的区别?
主键、外键和索引的区别
定义:
主键–唯一标识一条记录,不能有重复的,不允许为空
外键–表的外键是另一表的主键, 外键可以有重复的, 可以是空值
索引–该字段没有重复值,但可以有一个空值
作用:
主键–用来保证数据完整性
外键–用来和其他表建立联系用的
索引–是提高查询排序的速度
个数:
主键–主键只能有一个
外键–一个表可以有多个外键
索引–一个表可以有多个唯一索引
The difference between master, external and index keys?
The difference between primary, external and index keys
Definition:
Main Keys - The only identifier is a record that cannot be repeated, is not allowed to empty
Foreign Keys - The external key of the table is the main key of the other table, and the external key can be repeated, which can be an empty value
Main Keys - The main key - the primary key can only have a
14. 你可以用什么来确保表格里的字段只接受特定范围里的值?
答:Check限制,它在数据库表格里被定义,用来限制输入该列的值。
触发器也可以被用来限制数据库表格里的字段能够接受的值,但是这种办法要求触发器在表格里被定义,这可能会在某些情况下影响到性能。
What can you use to ensure that the field in the table only accepts values in a given range?
Answer: Check limits, which is defined in the database table to limit the entry of values in that column.
triggers can also be used to limit the acceptable values of fields in the database table, but this approach requires that the trigger be defined in the table, which may affect performance in some cases.
15. 说说对SQL语句优化有哪些方法?(选择几条)
(1)Where子句中:where表之间的连接必须写在其他Where条件之前,那些可以过滤掉最大数量记录的条件必须写在Where子句的末尾.HAVING最后。
(2)用EXISTS替代IN、用NOT EXISTS替代NOT IN。
(3) 避免在索引列上使用计算
(4)避免在索引列上使用IS NULL和IS NOT NULL
(5)对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引。
(6)应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引而进行全表扫描
(7)应尽量避免在 where 子句中对字段进行表达式操作,这将导致引擎放弃使用索引而进行全表扫描
Say, what are the ways to optimize the SQL statement? (Selection of several)
(1)Where clause: connections between where tables must be written before other Wheel conditions, those conditions that can filter out the maximum number of records must be written at the end of the Wheel clause.
(2) replace IN with EXISTS, NOT EXISTS replace NOT IN.
(3) avoid using
on the index column to calculate >br>(4) avoid using ISNULL and ISNOTNUL
(5) on the index column to optimize queries, avoid as much as possible scanning the full list as possible, and first consider creating an index on the column where and order by.
(6) avoid using the net value of the word in the lower sentence where it is used, otherwise the engine should be removed from the full-screening table instead of indexing
(7).
16. SQL语句中‘相关子查询’与‘非相关子查询’有什么区别?
答:子查询:嵌套在其他查询中的查询称之。
子查询又称内部,而包含子查询的语句称之外部查询(又称主查询)。
所有的子查询可以分为两类,即相关子查询和非相关子查询
(1)非相关子查询是独立于外部查询的子查询,子查询总共执行一次,执行完毕后将值传递给外部查询。
(2)相关子查询的执行依赖于外部查询的数据,外部查询执行一行,子查询就执行一次。
故非相关子查询比相关子查询效率高
What is the difference between `relevant sub-Query' and `non-relevant sub-Query' in the SQL statement?
Answer: Sub-Query: Embedded in other queries referred to as queries.
Sub-Query also referred to as internal and included sub-Query external (also known as main query). All sub-Query of
Sub-Query is therefore more efficient than related sub-Query.
17. char和varchar的区别?
答:是一种固定长度的类型,varchar则是一种可变长度的类型,它们的区别是:
char(M)类型的数据列里,每个值都占用M个字节,如果某个长度小于M,MySQL就会在它的右边用空格字符补足.(在检索操作中那些填补出来的空格字符将被去掉)在varchar(M)类型的数据列里,每个值只占用刚好够用的字节再加上一个用来记录其长度的字节(即总长度为L+1字节).
The difference between char and varchar?
answer: is a fixed length type, and varchar is a variable length type:
char(M) type data columns, each value takes an M byte, and if a length is smaller than M, MySQL fills it with a space character on the right. (The filled spaces will be removed in the search operation) In the varchar (M) type data columns, each value is only by just enough bytes to record its length (i.e. the total length is L+1 bytes).
18. Mysql 的存储引擎,myisam和innodb的区别。
答:简单的表达:
MyISAM 是非事务的存储引擎;适合用于频繁查询的应用;表锁,不会出现死锁;适合小数据,小并发
innodb是支持事务的存储引擎;合于插入和更新操作比较多的应用;设计合理的话是行锁(最大区别就在锁的级别上);适合大数据,大并发。
Mysql's storage engine, the difference between Myisam and innodb.
Answer: Simple expression:
MyISAM is a non-contingent storage engine; suitable applications for frequent queries; table locks, no dead locks; suitable for small data, small and distributed
innodb is a supporting service memory engine; compatible with a greater number of applications for insertion and updating; reasonably designed locks (the maximum difference is at the level of the lock); appropriate large data, large and sent.
19. 数据表类型有哪些
答:MyISAM、InnoDB、HEAP、BOB,ARCHIVE,CSV等。
MyISAM:成熟、稳定、易于管理,快速读取。一些功能不支持(事务等),表级锁。
InnoDB:支持事务、外键等特性、数据行锁定。空间占用大,不支持全文索引等。
Answers: MyISAM, InnoDB, HEAP, BOB, ARCHIVE, CSV, etc.
MyISAM: mature, stable, easy to manage, quick to read. Some functions do not support (services, etc.), table locks.
InnoDB: Support services, external keys, etc., data line locking. Space is occupied large and does not support full-text indexing, etc.
20. MySQL数据库作发布系统的存储,一天五万条以上的增量,预计运维三年,怎么优化?
a. 设计良好的数据库结构,允许部分数据冗余,尽量避免join查询,提高效率。
b. 选择合适的表字段数据类型和存储引擎,适当的添加索引。
c. mysql库主从读写分离。
d. 找规律分表,减少单表中的数据量提高查询速度。
e.添加缓存机制,比如memcached,apc等。
f. 不经常改动的页面,生成静态页面。
g. 书写高效率的SQL。比如
a. A well-designed database structure that allows partial data redundancy and avoids as much as possible join queries and efficiency gains.
b. Select the appropriate table field data type and storage engine, appropriate index additions.
c. Mysql Library master separates from reading and writing.
d. Find regular tabs that reduce the amount of data in the list to increase the speed of searching.
e. Add cache mechanisms, such as metcached, apc.
f. Make static pages that are not often changed and generate static pages.
g. Write efficient SQL, for example.
g.
SELECT * FROM TABEL 改为 SELECT field_1, field_2, field_3 FROM TABLE.
1
SELECT * FROM TABEL 改为 SELECT field_1, field_2, field_3 FROM TABLE.
21. 对于大流量的网站,您采用什么样的方法来解决各页面访问量统计问题?
答:
a. 确认服务器是否能支撑当前访问量。
b. 优化数据库访问。
c. 禁止外部访问链接(盗链), 比如图片盗链。
d. 控制文件下载。
e. 使用不同主机分流。
f. 使用浏览统计软件,了解访问量,有针对性的进行优化。
SELECT * FROM TABEL becomes SELECT Field_1, Field_2, Field_3 FROM TABLE.
1
SELECT * FROM TABEL becomes SELECT Field_1, Field_2, Field_3 FROM TABLE.
21. For large traffic websites, how do you solve the statistical problem of page access?
answered:
a. Confirms whether the server can support the current number of accesses.
b. Optimize database access.
c. Bans external access links (the chain of theft), such as photo thefts.
d. Control document downloads.
e. Use different mainframe streams.
f. Use br>
三:面向对象部分
返回顶部
III: The object section
returns to the top
1、什么是面向对象?(理解着回答)
答:面向对象OO=面向对象的分析OOA + 面向对象的设计OOD + 面向对象的编程OOP;通俗的解释就是“万物皆对象”,把所有的事物都看作一个个可以独立的对象(单元),它们可以自己完成自己的功能,而不是像C那样分成一个个函数。
1 What is object-oriented? (understand the answer)
Answer: Object-oriented OO = object-oriented analysis OOA + Object-oriented design OOD + object-oriented programming OOP; the general explanation is “everyone object” and treats everything as a stand-alone object (unit) that can perform its functions on its own rather than as a function as C.
现在纯正的OO语言主要是Java和C#,PHP、C++也支持OO,C是面向过程的。
Now pure OO languages are mainly Java and C#, PHP, C++ also support OO, and C is process-oriented.
2、简述 private、 protected、 public修饰符的访问权限。
答:private : 私有成员, 在类的内部才可以访问。
A brief description of access rights for privaté, protected, public emulators.
Answer: private: Private members can only be accessed internally in the class.
protected : 保护成员,该类内部和继承类中可以访问。
Protected: Protection of members, which is accessible both internally and in the succession category.
public : 公共成员,完全公开,没有访问限制。
Public: Public members, totally public, with no access restrictions.
3、堆和栈的区别?
答:栈是编译期间就分配好的内存空间,因此你的代码中必须就栈的大小有明确的定义;
Three, the difference between stacks and stacks?
Answer: The storage space is allocated during the compilation, so that there must be a clear definition of the size of the stack in your code;
堆是程序运行期间动态分配的内存空间,你可以根据程序的运行情况确定要分配的堆内存的大小。
A stack is the memory space that is dynamically assigned during the program's operation, and you can determine the size of the stack's memory to be allocated according to the program's operation.
4、XML 与 HTML 的主要区别
答:(1) XML是区分大小写字母的,HTML不区分。
(2) 在HTML中,如果上下文清楚地显示出段落或者列表键在何处结尾,那么你可以省略
或者
之类的结束 标记。在XML中,绝对不能省略掉结束标记。
(3) 在XML中,拥有单个标记而没有匹配的结束标记的元素必须用一个 / 字符作为结尾。这样分析器就知道不用 查找结束标记了。
(4) 在XML中,属性值必须分装在引号中。在HTML中,引号是可用可不用的。
(5) 在HTML中,可以拥有不带值的属性名。在XML中,所有的属性都必须带有相应的值。
4. The main difference between XML and HTML
answer: (1) XML is case-sensitive and HTML is not.
(2) In HTML, if the context clearly shows where the paragraph or list key ends, you can omit the end mark
or the end mark
. In XML, the end mark cannot be omitted.
(3) In XML, elements with a single mark without a matching end mark must end with a character.
(4) In XML, the attribute value must be separated into a quote.
(5) In HTML, all attributes must bear the corresponding value.
5、面向对象的特征有哪些方面?
答:主要有封装,继承,多态。如果是4个方面则加上:抽象。
下面的解释为理解:
封装:
封装是保证软件部件具有优良的模块性的基础,封装的目标就是要实现软件部件的高内聚,低耦合,防止程序相互依赖性而带来的变动影响.
继承:
在定义和实现一个类的时候,可以在一个已经存在的类的基础之上来进行,把这个已经存在的类所定义的内容作为自己的内容,并可以加入若干新的内容,或修改原来的方法使之更适合特殊的需要,这就是继承。继承是子类自动共享父类数据和方法的机制,这是类之间的一种关系,提高了软件的可重用性和可扩展性。
多态:
多态是指程序中定义的引用变量所指向的具体类型和通过该引用变量发出的方法调用在编程时并不确定,而是在程序运行期间才确定,即一个引用变量倒底会指向哪个类的实例对象,该引用变量发出的方法调用到底是哪个类中实现的方法,必须在由程序运行期间才能决定。
抽象:
抽象就是找出一些事物的相似和共性之处,然后将这些事物归为一个类,这个类只考虑这些事物的相似和共性之处,并且会忽略与当前主题和目标无关的那些方面,将注意力集中在与当前目标有关的方面。例如,看到一只蚂蚁和大象,你能够想象出它们的相同之处,那就是抽象。
5. What are the aspects of client-oriented features?
Answer: there are mainly seals, successions, multi-states. If there are four aspects, add: abstract.
is interpreted to read:
6、抽象类和接口的概念以及区别?
答:抽象类:它是一种特殊的,不能被实例化的类,只能作为其他类的父类使用。使用abstract关键字声明。
它是一种特殊的抽象类,也是一个特殊的类,使用interface声明。
(1)抽象类的操作通过继承关键字extends实现,而接口的使用是通过implements关键字来实现。
(2)抽象类中有数据成员,可以实现数据的封装,但是接口没有数据成员。
(3)抽象类中可以有构造方法,但是接口没有构造方法。
(4)抽象类的方法可以通过private、protected、public关键字修饰(抽象方法不能是private),而接口中的方法只能使用public关键字修饰。
(5)一个类只能继承于一个抽象类,而一个类可以同时实现多个接口。
(6)抽象类中可以有成员方法的实现代码,而接口中不可以有成员方法的实现代码。
6 The concepts of abstraction and interfaces, as well as differences?
Answer: The abstract category: it is a special, non-example class, which can only be used as a parent for other classes. Use the abstrat keyword statement.
It is a special abstract category and a special class, which uses the interface statement.
(1) The operation of the abstract class is accomplished by succession to the keyextencs, whereas the interface is used only by the key words of the invocations.
(2) There are data members in the abstract category who can achieve the data encapsulation, but there are no data members in the interface.
(3) The abstract method of the interface can be constructed in the abstract category, but there is no method of construction in the same.
The abstract category method of the abstract category can be achieved through private, protected, public key modifier (the abstract method cannot be private), whereas the interface method of the interface can be achieved only by the public keyword.
7、什么是构造函数,什么是析构函数,作用是什么?
答:构造函数(方法)是对象创建完成后第一个被对象自动调用的方法。它存在于每个声明的类中,是一个特殊的成员方法。作用是执行一些初始化的任务。Php中使用__construct()声明构造方法,并且只能声明一个。
析构函数(方法)作用和构造方法正好相反,是对象被销毁之前最后一个被对象自动调用的方法。是PHP5中新添加的内容作用是用于实现在销毁一个对象之前执行一些特定的操作,诸如关闭文件和释放内存等。
7, what is a construction function, what is an analysis function, and what is the function?
answer: The construction function (the method) is the first way to be called automatically by the object after the object has been created. It exists in each declaration category, and is a special member approach. It is used to perform some initialization tasks. Php uses _construct() to declare the method of construction, and only one.
the function and the method of construction are exactly the opposite, the last way to be called automatically by the object before it is destroyed. It is the newly added content in PHP5 that is used to perform certain operations, such as closing files and releasing memory, before an object is destroyed.
8、如何重载父类的方法,举例说明
答:重载,即覆盖父类的方法,也就是使用子类中的方法替换从父类中继承的方法,也叫方法的重写。
覆盖父类方法的关键是在子类中创建于父类中相同的方法包括方法的名称、参数和返回值类型。PHP中只要求方法的名称相同即可。
8- How to reload a parent, for example
answer: Reload, i.e. the method of covering a parent, i.e. the method of replacing a parent with a subcategory method, is also called a rewrite of the method. The key to
's method of covering a parent is that the same method is created in a subcategory, including the name of the method, the parameters and the type of return value. The PHP only requires the same name for the method.
9、常用的魔术方法有哪些?举例说明
答:php规定以两个下划线(__)开头的方法都保留为魔术方法,所以建议大家函数名最好不用__开头,除非是为了重载已有的魔术方法。
__construct() 实例化类时自动调用。
__destruct() 类对象使用结束时自动调用。
__set() 在给未定义的属性赋值的时候调用。
__get() 调用未定义的属性时候调用。
__isset() 使用isset()或empty()函数时候会调用。
__unset() 使用unset()时候会调用。
__sleep() 使用serialize序列化时候调用。
__wakeup() 使用unserialize反序列化的时候调用。
__call() 调用一个不存在的方法的时候调用。
__callStatic()调用一个不存在的静态方法是调用。
__toString() 把对象转换成字符串的时候会调用。比如 echo。
__invoke() 当尝试把对象当方法调用时调用。
__set_state() 当使用var_export()函数时候调用。接受一个数组参数。
__clone() 当使用clone复制一个对象时候调用。
9, what are the usual magic methods? Example: 10、$this和self、parent这三个关键词分别代表什么?在哪些场合下使用? What are the three key words, 10, $this, and Self, and parent, respectively? On which occasions? 11、类中如何定义常量、如何类中调用常量、如何在类外调用常量。 11, How constants are defined in the class, how constants are called in the class, how constants are called in the class, how they are called in the class. 12、作用域操作符::如何使用?都在哪些场合下使用? 12 Field operator: How do you use it? Under what circumstances? 13、__autoload()方法的工作原理是什么? 13, _autoload() how is the method working? 四:ThinkPHP部分 IV: The ThinkPHP section 1、常见的PHP框架 1. Common PHP framework 2、如何理解TP中的单一入口文件? 2- How to understand the single entry document in the TP? 3、ThinkPHP中的MVC分层是什么?(理解) The MVC layer in ThinkPHP is largely defined in 4、如何进行SQL优化?(关于后边的解释同学们可以进行理解,到时根据自己的理解把大体意思说出来即可) Four, how can SQL be optimized? (You can understand that even if you need a update field, the whole table will be locked up, and even if you do not use more, you will be better off if you don't use more, and MySQL, including two storage engines Myimam and InnoDB. 5、如何理解 ThinkPHP 3.0 架构三(核心 + 行为 + 驱动)中的行为? 5- How do you understand the behavior in the TinkP 3.0 architecture (core + behavior + drive)? 6、什么是惯例配置? 6 and what is the custom configuration? 7、什么是SQL注入?(理解) 7 and what is SQL injection? (understand) 8、ThinkPHP如何防止SQL注入?(理解) 8. How does ThinkPHP prevent SQL injection? (understand) 9、如何开启调试模式?调试模式有什么好处? How to start debug mode? What good is debug mode? 开启调试模式 The advantage of starting debug mode 10、TP中支持哪些配置模式?优先级? 10, which configuration models are supported in TP? Priority? 11、TP中的URL模式有哪几种?默认是哪种? How many URLs are in TP? Which is the default? 12、TP中系统变量有哪些?如何获取系统变量? 12. What are the system variables in TP? How do you get the system variables? 13、ThinkPHP框架中D函数与M函数的区别是什么? 13, What is the difference between function D in the ThinkPHP framework and function M? 五:smarty模板引擎 Five: smarty template engine 1、编译和缓存区别? The compilation process is to bring the template and replace the labels with the corresponding php code, which is the compilation of the pharty, which is the process that mixes the php and html 2、什么是smarty? Smarty的优点是什么? 2 and what's the merit of smarty? 3、在模板中使用{$smarty}保留变量 3; use of {$smarty} in the template to retain variables {$smarty.const._MY_CONST_VAL} {$smarty.cost._MY_CONST_VAL} {br}$smarty.cost.FILE} 7、缓存机制 7. If the cache 8、smarty的赋值和载入模板 8, value assigned to and contained in template 10、smarty配置主要有哪几项? 11、smarty在使用过程中需要注意哪些细节? What details do you need to take into account in using it? 12、smarty运用过程中要注意以下几个问题: The following questions should be noted during the use of 六、二次开发系统(DEDE、ecshop) The secondary development system (DEE, ecshop) 1、对二次开发的理解 The second development of the understanding of secondary development 2、MVC 2 MVC 3、二次开发程序安装后访问时候出现一些警告以及错误 3. Some warnings and errors 4、功能,模板的更换,功能的添加修改 4. Functions, changes in templates, addition changes in functionality 5、用过哪些二次开发的东西? What do you use for secondary development? 6、像php做一次开发好,还是二次开发好? Six, like php, for development or secondary development? 7、二次开发过程中很多类与类之间进行之间的方法访问,是通过什么方式传递的? How does methodological access between categories and classes in the secondary development process pass through? 8、dedecms如果更换目录,后台某项就进不去了如何解决? How is it that if you change the directory, you can't get one in the backstage? 9、dedecms中自定义模型的理解? 9, understanding of custom models in dedecms? 10、dede中概念,设计和使用模板,必须要理解下面几个概念 The concepts in 10, dede, and the design and use of templates, must understand the following concepts 11、dede中几种标签的使用? The use of several labels in 11, dede? 12、熟悉常用类库 12; familiar with common library 七、微信公众平台开发 The development of the micro-credit public platform 1、微信运行机制 1. What language does the micromail operating mechanism $postStr=$GLOBALS["HTTP_RAW_POST_DATA"];//接收数据 XML数据 $potstr=$GLOBALS ["HTTP_RAW_POST_DATA"];// Receive data XML data 3、将整个文件读入一个字符串的函数是 3. The function to read the entire file into a string is 4、常用函数 4. The usual function 5、Sprintf函数的作用 5. The role of the Springf function 6、微信公众号出现无法提供服务的原因? 6. The cause of the unserviceability of the CVC? $myfile=fopen("newfile.txt", "w"); $myfile=open("newfile.txt", "w"); 8、token的作用 8. Token role 9、Appid与secrect的作用 9. The role of Appid and secrect 八、对于自身掌握的技术描述 VIII. There is some understanding of target-oriented secondary development systems such as the
set() is used when assigning value to undefined attributes.
set() is used when using undefined attributes, so it is suggested that the function name is better not to start with.
cost() is used automatically when reloading an existing magic method.
_default() objects are called automatically at the end of their use.
答:$this 当前对象
self 当前类
parent 当前类的父类
$this在当前类中使用,使用->调用属性和方法。
self也在当前类中使用,不过需要使用::调用。
parent在类中使用。
Answer: $this current object
self is used in the current class of parent
parent
$this is used in the current class, using -> calling attributes and methods.
self is also used in the current class, but it needs to be used: calling.
pent is used in the class.
答:类中的常量也就是成员常量,常量就是不会改变的量,是一个恒值。
定义常量使用关键字const.
例如:const PI=3.1415326;
无论是类内还是类外,常量的访问和变量是不一样的,常量不需要实例化对象,
访问常量的格式都是类名加作用域操作符号(双冒号)来调用。
即:类名 :: 类常量名;
Answer: Constants in the class are members constants, constants are constants.
Defines constants using keywords const.
e.g.: const PI=31415326;
has different access to constants and variables, both within and outside the class, with no need for exaggeration objects, and the format of
Defines constants using keywords.
, i.e., generics.
答:调用类常量
调用静态方法
Answer: Call a class constant
答:使用这个魔术函数的基本条件是类文件的文件名要和类的名字保持一致。
当程序执行到实例化某个类的时候,如果在实例化前没有引入这个类文件,那么就自动执行__autoload()函数。
这个函数会根据实例化的类的名称来查找这个类文件的路径,当判断这个类文件路径下确实存在这个类文件后
就执行include或者require来载入该类,然后程序继续执行,如果这个路径下不存在该文件时就提示错误。
使用自动载入的魔术函数可以不必要写很多个include或者require函数。
Answer: The basic condition for using this magic function is that the filename of a class file is identical to the name of the class.
When the program is implemented to exemplify a class, if this category is not introduced before the expository version, then the _autoload() function will automatically be performed.
will search the path of this class of documents by the name of an exemplified class. When
is judged to exist under a file path of this class,
will perform the include or require to enter the class, and then the program will continue, if the file does not exist under this path, it will cause errors.
using the automatically loaded magic function could unnecessarily write many include or require functions.
返回顶部
returns to the top
答:thinkPHP、yii、ZendFramework、CakePhp、sy
answer: thinkPHP, yii, ZendFramework, CakePhp, sy
答:ThinkPHP采用单一入口模式进行项目部署和访问,无论完成什么功能,一个项目都有一个统一(但不一定是唯一)的入口。应该说,所有项目都是从入口文件开始的,并且所有的项目的入口文件是类似的,入口文件中主要包括:
定义框架路径、项目路径和项目名称(可选)
定义调试模式和运行模式的相关常量(可选)
载入框架入口文件(必须)
Answer: ThinkPHP uses a single entry mode for project deployment and access, with a single (but not necessarily the only) entry point for a project regardless of function. It should be said that all items start with the entry file and that all items have a similar entry document, which mainly includes:
definition of the frame path, project path and project name (optional)
definition of the debug mode and associated constant (optional) of the operation mode
entry into the framework entry document (must be)
答:MVC 是一种将应用程序的逻辑层和表现层进行分离的方法。ThinkPHP 也是基于MVC设计模式的。MVC只是一个抽象的概念,并没有特别明确的规定,ThinkPHP中的MVC分层大致体现在:
模型(M):模型的定义由Model类来完成。
控制器(C):应用控制器(核心控制器App类)和Action控制器都承担了控制器的角色,Action控制器完成业务过程控制,而应用控制器负责调度控制。
视图(V):由View类和模板文件组成,模板做到了100%分离,可以独立预览和制作。
但实际上,ThinkPHP并不依赖M或者V ,也就是说没有模型或者视图也一样可以工作。甚至也不依赖C,这是因为ThinkPHP在Action之上还有一个总控制器,即App控制器,负责应用的总调度。在没有C的情况下,必然存在视图V,否则就不再是一个完整的应用。
总而言之,ThinkPHP的MVC模式只是提供了一种敏捷开发的手段,而不是拘泥于MVC本身。
models.
controllers (C): Application controllers (Core controllers App Class) and Action controllers assume the role of controllers. The Action controller completes business process controls and the application controller is responsible for movement control.
view (V): The template is 100% separated by View and template files, and can be read and produced independently.
But in practice, ThinkHP is not dependent on Model and M or V, that is, it is not a model or view that can work.
答:(1)选择正确的存储引擎
以 MySQL为例,包括有两个存储引擎 MyISAM 和 InnoDB,每个引擎都有利有弊。
MyISAM 适合于一些需要大量查询的应用,但其对于有大量写操作并不是很好。甚至你只是需要update一个字段,整个表都会被锁起来,而别的进程,就算是读进程都无法操作直到读操作完成。另外,MyISAM 对于 SELECT COUNT(*) 这类的计算是超快无比的。
InnoDB 的趋势会是一个非常复杂的存储引擎,对于一些小的应用,它会比 MyISAM 还慢。但是它支持“行锁” ,于是在写操作比较多的时候,会更优秀。并且,他还支持更多的高级应用,比如:事务。
(2)优化字段的数据类型
记住一个原则,越小的列会越快。如果一个表只会有几列罢了(比如说字典表,配置表),那么,我们就没有理由使用 INT 来做主键,使用 MEDIUMINT, SMALLINT 或是更小的 TINYINT 会更经济一些。如果你不需要记录时间,使用 DATE 要比 DATETIME 好得多。当然,你也需要留够足够的扩展空间。
(3)为搜索字段添加索引
索引并不一定就是给主键或是唯一的字段。如果在你的表中,有某个字段你总要会经常用来做搜索,那么最好是为其建立索引,除非你要搜索的字段是大的文本字段,那应该建立全文索引。
(4)避免使用Select *从数据库里读出越多的数据,那么查询就会变得越慢。并且,如果你的数据库服务器和WEB服务器是两台独立的服务器的话,这还会增加网络传输的负载。即使你要查询数据表的所有字段,也尽量不要用*通配符,善用内置提供的字段排除定义也许能给带来更多的便利。
(5)使用 ENUM 而不是 VARCHAR
ENUM 类型是非常快和紧凑的。在实际上,其保存的是 TINYINT,但其外表上显示为字符串。这样一来,用这个字段来做一些选项列表变得相当的完美。例如,性别、民族、部门和状态之类的这些字段的取值是有限而且固定的,那么,你应该使用 ENUM 而不是 VARCHAR。
(6)尽可能的使用 NOT NULL
除非你有一个很特别的原因去使用 NULL 值,你应该总是让你的字段保持 NOT NULL。 NULL其实需要额外的空间,并且,在你进行比较的时候,你的程序会更复杂。 当然,这里并不是说你就不能使用NULL了,现实情况是很复杂的,依然会有些情况下,你需要使用NULL值。
(7)固定长度的表会更快
如果表中的所有字段都是“固定长度”的,整个表会被认为是 “static” 或 “fixed-length”。 例如,表中没有如下类型的字段: VARCHAR,TEXT,BLOB。只要你包括了其中一个这些字段,那么这个表就不是“固定长度静态表”了,这样,MySQL 引擎会用另一种方法来处理。
固定长度的表会提高性能,因为MySQL搜寻得会更快一些,因为这些固定的长度是很容易计算下一个数据的偏移量的,所以读取的自然也会很快。而如果字段不是定长的,那么,每一次要找下一条的话,需要程序找到主键。
并且,固定长度的表也更容易被缓存和重建。不过,唯一的副作用是,固定长度的字段会浪费一些空间,因为定长的字段无论你用不用,他都是要分配那么多的空间。
Myisam are suitable for applications requiring a lot of queries.
答:核心 + 行为 + 驱动
TP官方简称为:CBD
核心(Core):就是框架的核心代码,不可缺少的东西,TP本身是基于MVC思想开发的框架。
行为(Behavior) :行为在新版ThinkPHP的架构里面起着举足轻重的作用,在系统核心之上,设置了很多标签扩展位,而每个标签位置可以依次执行各自的独立行为。行为扩展就因此而诞生了,而且很多系统功能也是通过内置的行为扩展完成的,所有行为扩展都是可替换和增加的,由此形成了底层框架可组装的基础。
驱动( Driver ):数据库驱动、缓存驱动、标签库驱动和模板引擎驱动,以及外置的类扩展。
框架,即framework。其实就是某种应用的半成品,就是一组组件,供你选用完成你自己的系统。简单说就是使用别人搭好的舞台,你来做表演。而且,框架一般是成熟的,不断升级的软件。
Answer: Core + behaviour + driver
TP official acronym: CBD
core (Core): is the core code of the framework, which is indispensable, and the TP itself is based on the MVC idea development framework.
Behaviour: The behavior in the new version of the ThinkHP structure plays a significant role in setting up label extensions over the core of the system, and each label location is capable of performing separate behaviours in turn.
答:惯例配置上一页下一页惯例重于配置是系统遵循的一个重要思想,系统内置有一个惯例配置文件(位于系统目录下面的Conf\convention.php),按照大多数的使用对常用参数进行了默认配置。所以,对应用项目的配置文件,往往只需要配置和惯例配置不同的或者新增的配置参数,如果你完全采用默认配置,甚至可以不需要定义任何配置文件。
惯例配置文件会被系统自动加载,无需在项目中进行加载。
Answer: The custom on the previous page of the custom configuration is more important than the configuration is an important idea that the system follows, with a custom configuration file (Conf\convention.php, located under the system directory) and default configuration of the usual parameters according to most uses. Therefore, the configuration of the application item often requires only different configurations or additional configuration parameters, and if you fully use the default configuration, you may not even need to define any configuration file.
the custom configuration file will be automatically loaded on the system and will not need to be loaded in the project.
答:SQL注入攻击是黑客对数据库进行攻击的常用手段之一。一部分程序员在编写代码的时候,没有对用户输入数据的合法性进行判断,注入者可以在表单中输入一段数据库查询代码并提交,程序将提交的信息拼凑生成一个完整sql语句,服务器被欺骗而执行该条恶意的SQL命令。注入者根据程序返回的结果,成功获取一些敏感数据,甚至控制整个服务器,这就是SQL注入。
answer: SQL infusion is one of the most common means of hacking a database. Some programmers do not judge the validity of user input data when compiling the code. Injectors can enter a database query code in their form and submit it. The program creates a complete sql statement from which the submitted information is congested and the server is deceived to execute the malign SQL command.
答:(1)查询条件尽量使用数组方式,这是更为安全的方式;
(2)如果不得已必须使用字符串查询条件,使用预处理机制;
(3)开启数据字段类型验证,可以对数值数据类型做强制转换;(3.1版本开始已经强制进行字段类型验证了)
(4)使用自动验证和自动完成机制进行针对应用的自定义过滤;
(5)使用字段类型检查、自动验证和自动完成机制等避免恶意数据的输入。
answer: (1) search conditions use as many arrays as possible, which is a safer way;
(2) use pre-processing mechanisms if string search conditions are not required;
(3) open data field type validation to enable mandatory conversion of numerical data types; (3.1 version begins to force field type validation)
(4) use of automatic validation and auto-completion mechanisms for custom-defined filtering of applications;
(5) use field type checks, auto-certification and auto-completion mechanisms to avoid malicious data entry.
答:开启调试模式很简单,只需要在入口文件中增加一行常量定义代码:
Answer: Starting debug mode is simple. Just add a line of constant definition to the entry file:
开启调试模式
在完成开发阶段部署到生产环境后,只需要删除调试模式定义代码即可切换到部署模式。开启调试模式后,系统会首先加载系统默认的调试配置文件,然后加载项目的调试配置文件,调试模式的优势在于: 开启日志记录,任何错误信息和调试信息都会详细记录,便于调试; 关闭模板缓存,模板修改可以即时生效; 记录SQL日志,方便分析SQL; 关闭字段缓存,数据表字段修改不受缓存影响; 严格检查文件大小写(即使是Windows平台),帮助你提前发现Linux部署问题; 可以方便用于开发过程的不同阶段,包括开发、测试和演示等任何需要的情况,不同的应用模式可以配置独立的项目配置文件。
to start deburetation mode
after completion of the development phase to the production environment is simply to remove debugging mode definition codes from the deployment mode. After opening debugging mode, the system first loads the default debugging configuration file of the system and then loads the debugging configuration file of the project, and the debugging mode is that: (a) log records are opened and any error and debugging information is recorded in detail to facilitate debugging; (b) templates caches are closed and template modifications can take effect immediately; (c) SQL logs are recorded to facilitate analysis of SQL; (d) field caches are closed and data sheet field changes are not subject to cache; (d) file sizes (even the Windows platform) are scrutinized to help you identify Linux deployment problems in advance; (d) different application models can be easily used to develop any need, including development, testing and demonstration, and stand-alone project configuration documents can be configured.
答:ThinkPHP在项目配置上面创造了自己独有的分层配置模式,其配置层次体现在: 惯例配置->项目配置->调试配置->分组配置->扩展配置->动态配置
以上是配置文件的加载顺序,因为后面的配置会覆盖之前的同名配置(在没有生效的前提下),所以优先顺序从右到左。
answer: ThinkPHP created its own unique layer configuration model on the project configuration, with the following configuration levels: Practice Configuration - > Project Configuration - > Debug Configuration - > Group Configuration - > Extension Configuration - > Dynamic Configuration
is the loading order of the configuration file, as the later configurations cover the same profile as before (without entry into force), so the priority is from the right to the left.
答:ThinkPHP支持四种URL模式,可以通过设置URL_MODEL参数来定义,包括普通模式、PATHINFO、REWRITE和兼容模式。
默认模式为:PATHINFO模式,设置URL_MODEL 为1
Answer: ThinkPHP supports four URL models, which can be defined by setting the URL_MODEL parameters, including the normal mode, PATHINFO, REWRITE, and compatible mode.
Default mode is: PATHINFO mode, setting the URL_MODEL to 1.
答:获取系统变量的方法:
只需要在Action中调用下面方法:
$this->方法名(“变量名”,[“过滤方法”],[“默认值”])
Answer: How to get the system variables:
just need to call the following in Action:
$this-> method name ("variant name", [`filter method'], [`default value']]
答:M方法实例化模型无需用户为每个数据表定义模型类,D方法可以自动检测模型类,如果存在自定义的模型类,则实例化自定义模型类,如果不存在,则会自动调用M方法去实例化Model基类。同时对于已实例化过的模型,不会重复去实例化(单例模式)。
Answer: The M-methodial executory model does not require the user to define the model category for each data sheet, the D-method automatically detects the model category, and, if a custom model class exists, the custom model class automatically calls M to executor the Model base category if it does not exist. At the same time, the executory model will not be repeated (single model).
返回顶部
returns to the top.
smarty的编译过程就是把模板拿过来,把里面的标签替换成相应php代码,这就是smarty的编译, 其实就是php和html混合的过程
smarty的缓存需要手动开启,smarty的缓存就是把编译好的文件执行后,同时生成一份静态的html页面,再次访问的时候,你访问的就是是html文件了,所以就效率来说,要高一些
smarty, which needs to be opened manually.
Smarty是一个使用PHP写出来的PHP模板引擎,目的是要使用PHP程序同美工分离,使的程序员改变程序的逻辑内容时不会影响到美工的页面设计,美工重新修改页面时不会影响到程序的程序逻辑,这在多人合作的项目中显的尤为重要。(也易于程序的多样式开发)
Smarty优点
1. 速度快:相对其他模板引擎。
2. 编译型:采用smarty编写的程序在运行时要编译成一个非模板技术的PHP文件
3. 缓存技术:它可以将用户最终看到的HTML文件缓存成一个静态的HTML页
4. 插件技术:smarty可以自定义插件。
不适合使用smarty的地方
1. 需要实时更新的内容。例如像股票显示,它需要经常对数据进行更新
2. 小项目。小项目因为项目简单而美工与程序员兼于一人的项目
Smarty is a PHP template engine written with PHP.
2. Compiler: PHP documents that use smarty programs to be translated into a non-template technology
3. Cache technology: it can save the HTML files that users end up seeing in a static HTML page
4. Intubation techniques: smarty can self-defined plugins.
2.
{$smarty.get.page} //类似在php脚本中访问$_GET[page]
{smarty.cookies.}
{smarty.post.}
{smarty.session.}
{smarty.server.}
1
2
3
4
5
{$smarty.get.page} //类似在php脚本中访问$_GET[page]
{smarty.cookies.}
{smarty.post.}
{smarty.session.}
{smarty.server.}
4. 在模板中访问php中的变量
在php脚本中有系统常量和自定义常量两种,同样这两种常量在Smarty模板中也可以被访问,而且不需要从php中分配,只要通过{$smarty}保留变量就可以直接输出常量的值。在模板中输出常量的示例:
$smarty.get.page} / similar access to $_GET[page]
{smarty.copies.} {br} {br} {smarty.possion.} {br} {br} {smarty.server.} {br>1br>2>br>3br>4br>brbr>5$smartty.get.page} / similar access to the php scripts
{$smarty.const.__FILE__}
1
2
{$smarty.const._MY_CONST_VAL}
{$smarty.const.__FILE__}
5、变量调解器
变量调解器
变量调解器
6、php查询mysql数据库时,查询中文结果时出现的乱码。怎么解决?
1. 文件属性(另存为)
2.文件meta(设置浏览器解析的时候)
3. 连接数据库时编码设定
4. PHP文件中使用header函数确定编码
1
2$smarty.cost.MY_CONST_VAL} {br}$smarty.cost.FILE}br>5; variable mediator
br>; variable mediator
6; php query Mysql database; how does it work?
1. Document attributes (otherly saved)
2. Document Meta (when creating browsers)
3.
如果开启了缓存,smarty同时生成一份静态的html页面,如果在设定的时间没有过期,再次访问的时候,你访问的就是是html文件了,减少了读取数据库,所以就效率来说,要高一些。
is opened, Smarty produces a static html page at the same time, and if the set time is not expired, when you visit it again, you visit the html file, reducing access to the database, so being more efficient.
$Smarty->assign(name,value)
$Smarty->display('index.html')
1
2
$Smarty->assign(name,value)
$Smarty->display('index.html')
9、marty模板技术的用途是什么?
为了php与html分开,美工和程序员各司其职,互不干扰。
$Smarty-> assign(name, value)
$Smarty-> display('index.html')
1
2>$Smartty-> assign(name, value)
$Smartty-> display('index.html')
9; marty template technology?
for purposes of php separation from html, there is no interference between divisions of art and programmers.
1. 引入smarty.class.php;
2. 实例化smarty对象;
3. 重新修改默认的模板路径;
4. 重新修改默认的编译后文件的路径;
5. 重新修改默认的配置文件的路径;
6. 重新修改默认的cache的路径。
7. 可以设置是否开启cache。
8. 可以设置左侧和右侧定界符。
1. Introduction of smarty.clas.php;
2. Exampleal smarty objects;
3. Remodify the default template path;
4. Remodify the default compiled file path;
5. Remodify the default configuration file path;
6. Remodify the default cache path.
7.
Smarty是基于MVC概念的一种模板引擎,它将一个页面程序分成了两部分来实现:即视图层和控制层,
也就是说smarty技术将用户UI与php代码分离开。
这样程序员和美工各司其职,互不干扰。
Smarty is a template engine based on the MVC concept, which divides a page program into two parts: the view and control layer,
which means that the smarty technology separates the user UI from the php code.
so that the programmer and the artwork division do not interfere with each other.
1.正确配置smarty。主要要实例化smarty对象,配置smarty模板文件的路径;
2.php页面中使用assign赋值 和display显示页面;
3.smarty模板文件中不允许出现php代码段,所有的注释,变量,函数都要包含在定界符内。
A.{}
B. foreach
C. if else
D. include
E. Literal
1. The following questions should be noted:
1. The main example of smarty objects should be configured with the path of the smarty template file;
2.php page uses the sassigning value and display page;
3.smarty template files do not allow the presence of php code segments, and all notes, variables, are included in the delimiter.
A.br>B. Forach
C. if else
D. include
E.Litral
返回顶部
returns to the top.
二次开发,简单的说就是在现有的软件上进行定制修改,功能的扩展,然后达到自己想要的功能,一般来说都不会改变原有系统的内核。
simply involves customizing changes on existing software, extending the functionality and then reaching the desired function, which generally does not change the original systematic kernel.
Model(模型)数据处理。
View(视图) 模板显示。
Controller(控制器) 控制流程。
MVC的概念是什么?各层主要做什么工作?
MVC(即模型-视图-控制器)是一种软件设计模式或者说编程思想。
M指Model模型层,V是View视图层(显示层或者用户界面),C是Controller控制器层。
使用mvc的目的是实现M和V分离,从而使得一个程序可以轻松使用不同的用户界面。
在网站开发中,
模型层一般负责对数据库表信息进行增删改查,
视图层负责显示页面内容,
控制器层在M和V之间起到调节作用,控制器层决定调用哪个model类的哪个方法,
执行完毕后由控制器层决定将结果assign到哪个view层。
Model (mode) data processing.
View (view) template displays.
Controller (controlr) control process.
MVC concept. What is the primary job of the layers?
MVC (i.e. model-view-controller) is a software design model or programming idea.
M means Model layer, V is a View viewing layer (a display or user interface) and C is a Controller control layer.
uses mvc to separate M and V so that a program can easily use different user interfaces.
The
model layer in the web site development is generally responsible for adding to or modifying the database table information,
view level is responsible for showing page content,
the control layer plays a mode of alignment between M and V,
the control layer determines which mode to be used, and
the control layer decides which mode to use after the control level decides which mode to use.
根据错误,来修改服务器配置参数以及百度
occurred during the post-redevelopment program access to modify server configuration parameters and 100 degrees based on errors
其实也就是面向对象的应用 用,以及模板的更换类似smarty的使用
are actually object-oriented applications, and changes in templates are similar to the use of smarty
Dedecms phpcms ecshop,基本这些的东西如果基础好了 学习起来都是没问题的。
Dedecms phpcms ecshop, basically if they're well-grounded, they're all fine to learn.
一般中小企业都用cms系统二次开发,都是为了效率。当然如果想一次开发也行,会用框架而且时间充足的话就可以了,大企业都是团队来开发的,杜绝版权问题。
Small and medium-sized enterprises use cms to develop them again, for efficiency. Of course, if they want to do so, they can use a framework and time. Large enterprises are developed by teams, and copyright issues are eliminated.
不是类继承而是对象组合,把实例化好的对象通过global传递进去
is not a sort of succession but a combination of objects, passing the examples through the global.
后台核心设置中修改成现在的 项目目录名称
changes the directory name to the current one in the back-office core set.
在织梦系统中有内容模型这个概念,不同内容模型可以用来构建不同内容形式的站点,在系统中自带了以下几种模型:普通文章、图集、软件、商品、分类信息、专题。通过系统自带的模型,我们可以用来构建不同类型的站点,例如:使用图集可以做一个图片站,用软件模型构建一个软件下载站点。
当然以上随系统附带的模型被称为系统模型,用户可以自己定义一些模型,比如图书、音乐专辑等,自定义了这些模型才可以构建更多内容形式的站点。
相当于我们自动添加了表结构,适应现在当前需求的变化
has the concept of content models in dream systems, where different content models can be used to build sites in different content forms, with the following models attached to the system: ordinary articles, atlases, software, commodities, taxonomic information, topics. Through the system's own models, we can build different types of sites, for example, using an atlas to make a picture station and a software model to build a software download site.
The models attached to the system are, of course, referred to as system models, and users can define models themselves, such as books, music albums, etc.
1. 板块(封面)模板:
指网站主页或比较重要的栏目封面频道使用的模板,一般用“index_识别ID.htm”命名,此外,用户单独定义的单个页面或自定义标记,也可选是否支持板块模板标记,如果支持,系统会用板块模板标记引擎去解析后才输出内容或生成特定的文件。
2. 列表模板:
指网站某个栏目的所有文章列表的模板,一般用 “list_识别ID.htm” 命名。
3. 档案模板:
表示文档查看页的模板,如文章模板,一般用 “article_识别ID.htm” 命名。
4. 其它模板:
一般系统常规包含的模板有:主页模板、搜索模板、RSS、JS编译功能模板等,此外用户也可以自定义一个模板创建为任意文件。
1.
2. List template:
refers to the template used for the home page of the website or for the more important section cover channel, generally named after "index_ID.htm". In addition, user-defined individual pages or custom-defined tags may be selected to support plate template tags, and if supported, the system will be able to enumerate content or generate specific files after using the plate-marking engine.
2. List template:
refers to a template for all articles in a column of the website, generally named after "list_ID.htm".
3. Archive template:
indicates a template for document viewing, such as an article template, usually named after "artique_ID.htm".
4. Other templates:
general system routine contains templates such as the home page template, search template, RSS, JS compilation template, etc.
列表 内容 等标签 只能在其本范围内使用,列表标签只能在列表中使用,内容标签只能在内容标签中使用。
全局标签能在所有页面中使用
list contents, etc. tabs can only be used in this context, list labels can only be used in the list, content labels can only be used in content labels.
global labels can be used on all pages
(例如:dedesql.class.php);熟悉系统函数库(common.func.php);熟悉自定义函数库(extend.func.php);熟悉前台入口文件(common.inc.php)
(e.g. dedesql.clas.php); familiar with system function library (common.func.php); familiar with custom function library (extend.func.php); familiar with front desk entrance documents (common.inc.php)
返回顶部
returns to the top
公众号与php之间用什么语言通信:Xml
Weixin.php中是如何接收公众号数据的:
communicate with php: Xml
Weixin.php how to receive public number data:
1
$postStr=$GLOBALS["HTTP_RAW_POST_DATA"];//接收数据 XML数据
2、消息类型
微信目前提供了7种基本消息类型,分别为:
(1)文本消息(text);
(2)图片消息(image);
(3)语音(voice)
(4)视频(video)
(5)地理位置(location);
(6)链接消息(link);
(7)事件推送(event)
类型。掌握不同的消息类型发送时的数据传递格式
1
$poststr=$GLOBALS ["HTTP_RAW_POST_DATA"];// Receive data XML data
2, message type
micro-mail
currently provides seven basic types of information:
text message (text);
photo message (image);
(3) voice (voice)
video (video)
(5) geographic location (location);
link message (link);
link message (link)
event forwarding (event)
>.
File_get_contents
File_get_contents
把xml数据解析成对象的函数是
simplexml_load_string( )
将字符串转换为数组的函数是___ explode_________,将数组转化为字符串的函数是____implode________.
编码 URL 字符串的字符串是____urlencode________.
to interpret Xml data into objects is
simplexml_load_string()
to convert string into arrays is explode, and the function to convert arrays into strings is implode...br>coded URL string is urlencode.
这个都是可以查手册的。
is searchable for the manual.
(1)网络原因 ,数据接口原因
(2)代码错误,怎么推测原因
修改的哪里检查一下,如果代码没错
可以输出数据 看一下。用php操作文件
(1) web reason, the reason for the data interface
(2) code error, how to guess where the
$txt="aaaaaaaaaa";
fwrite($myfile, $txt);
fclose($myfile);
1
2
3
4
$myfile=fopen("newfile.txt", "w");
$txt="aaaaaaaaaa";
fwrite($myfile, $txt);
fclose($myfile);
7、自定义菜单的事件推送
单击
单击跳转链接
扫码推事件
扫码推且弹出
弹出系统拍照发图的事件
弹出微信相册发图器的事件
弹出地理位置选择器的事件
$txt="aaaaaaaa";
fwrite($myfile, $txt);
fclose($myfile);
1>1>br>2
3
4
;
myfile=open("newfile.txt", "w");
$txt=aaaaaaaaa";
fwrite($myfile, $txt);
fclose($myfile);
7; events from defined menus sent to
; events from
click
to override
安全机制验证,用于微信服务器与PHP服务器之间的安全验证
security mechanism validation for security validation between the micro-mail server and the PHP server
请求api接口(例如菜单的操作)时需要传appid与secrect两个值,用来获取应用的授权码
requests api interfaces (e.g. menu operations) require appid and secrect values to be used to get the permissions for the application
返回顶部
1、以PHP+MYSQL为方向,熟练掌握smarty模板引擎、ThinkPHP框架、微信公众平台开发、DEDE、ecshop等二次开发系统,对面向对象有一定的理解;数据库方面,熟练掌握MYSQL、MSSQL等数据库;熟悉在linux下的PHP开发
2、前端技术:熟练掌握DIV+CSS网页布局,javascript,JQuery框架、AJAX技术、photoshop图片处理
3、一年的项目开发经验,使用smarty开发过‘XXXXXXXX’,ThinkPHP开发过‘XXXXXXXX’,使用微信公众平台开发过‘就业服务网’的公众号,使用织梦系统开发过企业站等
description of the technology in their possession; databases such as MySQL, MSSQL, etc.; familiar with the development of
2 by PHP+MYSQL under Linux; front-end technology: proficiency in the layout of the DIV+CS web page, Javascript, JQuery framework, AJAX technology, photo processing of photoshop
3, one-year project development experience using Marty, `XXXXX', ThinkPH has developed `employment services XXX', and the use of a micro-blogging public platform to develop the `employment services network', etc.
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论