Home >Backend Development >PHP Tutorial >Summary of the latest PHP classic interview questions in 2017
The content introduced in this article is a summary of the latest PHP classic interview questions in 2017. It has a certain reference value. Now I share it with you. Friends in need can refer to it.
This article will continue Update, I hope you can express your own opinions and classic topics in the comment area. The author will classify and hierarchize this article at appropriate nodes in the future. I hope you can correct the deficiencies in the article!
Double quotes explain variables, single quotes do not Interpretation of variables
Insert single quotation marks inside the double quotation marks. If there is a variable within the single quotation marks, the variable explanation
follows the variable name of the double quotation marks. There must be a special character that is not a number, letter, or underscore, or it must be enclosed in a variable. Otherwise, the part after the variable name will be treated as a whole, causing a syntax error
# to upload files
##$_SERVER ----->System environment variables#$_COOKIE will be used when ----->It will be used when session control
3, POST in HTTP, The difference between GET, PUT, and DELETE methods
3.1 The difference between get and post submission methods in the form
For the get method, the server uses Request.QueryString to obtain the value of the variable. For the post method, the server uses Request.Form to obtain the submitted data
The amount of data transmitted by get is small, and the amount of data transmitted by post is larger. It is generally unrestricted by default. However, in theory, the maximum amount is 80kb in IIS4 and 1000k in IIS5. Get is very secure. Low, post security is high
3.2
Different from GET, the PUT request sends data to the server to change the information. This request is just like the update operation of the database, used to modify the content of the data, but The type of data will not be increased, which means that no matter how many PUT operations are performed, the results will not be different.
POST request is similar to PUT request, both send data to the server, but this request will change the type of data and other resources, just like the insert operation of the database, it will create new Content. Almost all current submission operations are requested using POST.
DELETE request, as the name suggests, is used to delete a certain resource. This request is like the delete operation of the database.
4. Introduction to PHP
Personal Home Page Original name
Target purpose:
Allows web developers to quickly write dynamically generated web pages. Compared with other pages, PHP embeds programs into HTML documents for execution, and is more efficient than Fully generated CGI for HTML editing is much higherHTML: Hypertext Markup Language
Founder: Rasmus Lerdorf , born in 1968, University of Waterloo, Canada
Ledolf first wrote the maintenance program in prel language to maintain his personal web page, and then rewritten it in c, which eventually led to php/fiTimeline:
1995.06.08 Public release of PHP/FI
1995 php2.0, adding support for MySQL
1997 php3.0
2000 php4.0
2008 php5.0
Since php6.0 does not fully solve Unicode encoding, there is basically no application on the production line. It is basically just a concept product. Many functions have been implemented on php5.3.3 and php5.3.4
Common IDE(Intergrated Development Environment): Integrated Development Environment
Coda (mac)
Common text editor with code highlighting :
PHP features:
Advantages of PHP:
PHP technology application:
* echo、print是php语句,var_dump和print_r是函数 * echo 输出一个或多个字符串,中间以逗号隔开,没有返回值是语言结构而不是真正的函数,因此不能作为表达式的一部分使用 * print也是php的一个关键字,有返回值 只能打印出简单类型变量的值(如int,string),如果字符串显示成功则返回true,否则返回false* print_r 可以打印出复杂类型变量的值(如数组、对象)以列表的形式显示,并以array、object开头,但print_r输出布尔值和NULL的结果没有意义,因为都是打印"\n",因此var_dump()函数更适合调试 * var_dump() 判断一个变量的类型和长度,并输出变量的数值
Common HTTP status codes:
HTTP status code classification:
$_SERVER["REMOTE_ADDR"]; or getenv('REMOTE_ADDR')ip2long for conversion
Server:
gethostbyname('www.baidu.com')
Smarty:Smarty is a very old PHP template engine. It was my initial choice for using templates in this language. Although it is updated less frequently and lacks some features of the new generation of template engines, it is still worth a look.
13. For high-traffic websites, what methods should be used to solve the traffic problemUse different hosts to divert main traffic
require is an unconditional inclusion, that is, if require is added to a process, it will be executed first regardless of whether the condition is true or not. require, when the file does not exist or cannot be opened, an error will be prompted and the program execution will be terminated
include has a return value, but require does not (maybe because require is faster than include Fast), if the included file does not exist, an error will be prompted, but the program will continue to execute.
Note: When the included file does not exist or the syntax is wrong, require is Fatal, and include is not
require_once means it is included only once, avoiding repeated inclusion
The application is completed by the model, view, and controller. The model sends the functions to be implemented to the controller, and the controller receives the organizational functions and passes them to the view
Variables are always assigned by value by default, that is to say, when the value of an expression is assigned to a variable, the value of the entire expression is assigned to the target variable, which means: When When one variable is assigned to another variable, changing the value of one variable will not affect the other variable
php also provides another way to assign values to variables: reference assignment. This means that the new variable simply __references__ (in other words, becomes an alias or pointer to) the original variable. Changes to new variables will affect the original variables and vice versa. Use reference assignment, simply add an & symbol before the variable to be assigned (source variable)
The object defaults to pass-by-reference. For larger data, it is better to pass by reference, which can save memory overhead. Related recommendations:Summary of php interview questions
PHP classic interview question setPHP classic interview question set
The most complete and detailed PHP interview questions (with answers)
The above is the detailed content of Summary of the latest PHP classic interview questions in 2017. For more information, please follow other related articles on the PHP Chinese website!