1. The difference between echo, Print_r, print, Var_dump
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() 判断一个变量的类型和长度,并输出变量的数值
2,HTTP status code classification:
- 1**-Information, requests received by the server that require the requestor to continue to perform the operation
- 2**-Successful, the operation is successfully received and processed
- 3**-redirect, requires further action to complete the request
- 4**-Client error, request contains syntax error or unable to complete request
- 5** Server error, the server has an error while processing the request
3, the method of optimizing the database
- Select the most applicable field properties, minimize the width of the field as much as possible, and set the field to Notnull, such as ' Province ', ' gender ', best for enum
- Use connection (join) instead of subquery
- Apply Union (Union) instead of manually created temporary table
- Transaction processing
- Lock table, optimize transaction processing
- Apply foreign key, optimize lock table
- Build an index
- Refine query statements
4, commonly used super-global variables (8)
- $_get----->get Transfer Mode
- $_post----->post Transfer Mode
- $_request-----> can receive values for get and post two ways
- $GLOBALS-----> All the variables are in there.
- $_file-----> Upload files using
- $_server-----> System Environment variables
- $_session-----> Session control will be used.
- $_cookie-----> Session control will be used.
5 using PHP to print out the day before the time format is
echo Date (' y-m-d h:i:s ', Strtotime ('-1 day '));
6 implementation of the text string interception without garbled method.
Mb_substr ()
7 How to modify the session lifetime
$lifeTime = 24 * 3600;
Session_set_cookie_params ($lifeTime);
8. Briefly describe the ways in which the SQL statement performance is optimized in the project, and in what ways do you analyze it?
(1) Select the most efficient table name order
(2) connection order in the WHERE clause
(3) Avoid using ' * ' in the SELECT clause
(4) Replace the HAVING clause with a WHERE clause
(5) Improve SQL efficiency with intrinsic functions
(6) Avoid using calculations on indexed columns.
(7) Improve the efficiency of the group BY statement by filtering out unwanted records before group by. 9. Prevent SQL Injection Vulnerability general use __addslashes___ function
Basic knowledge of PHP frequently met questions