PHP interview questions, including php Basics, mysql, network, and front-end knowledge

Source: Internet
Author: User
Tags http 200 php basics php cli
This program code has the "IP address forgery" vulnerability. how can this problem be solved? PHP interview questions, including php Basics, mysql, network, and front-end knowledge

Php Basics

  1. 1. what are the output results of the following php code?
    $ I = 10;

$ N = $ I ++;

Echo $ n, $ I ++, ++ $ I

2. what is the difference between include and require?
3. the following code is used to determine whether the # symbol exists in the string. what is the error?
If (strpos ($ str, "#") {… }

4. the program code uses utf-encoding. what is the output result of the following code? Does the strlen function calculate the number of bytes or characters of a string?
$ Str = "hello ";

Echo strlen ($ str );

5. what is a timestamp? What is the minimum and maximum year that a timestamp can represent?

6. what is the role of magic_quotes_gpc and magic_quotes_runtime in the php. ini configuration file? Should I enable or disable it?

7. Currently, the size of a text file is about 2 GB, and the computer memory is only 1 GB. you need to use php to analyze the data. how can you read such a volume of files?

8. what is the purpose of php deserialization?

9. What are the magic methods of php (the more the better )? Under what circumstances is it automatically called?

10. what is the role of the ArrayAccess interface?

11. what is the difference between static and non-static member variables of the php class?

12. how to record php program errors to system logs (such as windows Event Viewer and Linux syslog )?

13. what is the most effective defense method for SQL injection?

 

Mysql database (mysql version 5.0 +)

1. assume that the mysql data table uses UTF-8 encoding and the numeric type specifies the range and length of the following data types.

Type Bytes Value range
Unsigned TinyINT (2)    
Unsigned SmallINT (3)    
Unsigned MediumINT (4)    
Unsigned INT (5)    
Unsigned BigINT (6)    

 

2. assume that the mysql data table uses UTF-8 encoding. fill in the following table

Type Maximum number of bytes Maximum number of characters
Char (100)    
Varchar (200)    

 

3. What is the difference between char (100) and varchar (100?

4. how can I view the execution plan of an SQL statement to analyze its performance problems?

  1. 5. what is the difference between MyISAM and innoDB storage engines? Which engine is better to use for applications similar to CMS and bbs?

 

HTTP protocol

1. what is the meaning of http 200,404,304 status code?

2. http gzip compression transmission, what is going on?

3. some websites (such as baidu, 163.com) use mobile phones and computers to access the same domain name, and the displayed pages are different. how can this problem be achieved?

4. what is the relationship between cookies and Sessions ?, Disable the cookie of the browser. Can the session work normally?

5. by default, the session will expire when the browser is closed. what should I do if I want to extend the session lifecycle (for example, one month?

6. how can XSS and CSRF attacks be prevented?

7. how to cache dynamic files (such as php pages) in a browser? (That is, the status 304 is returned when the browser is refreshed for the second time)

8. at the HTTP application layer, the importance of the source IP address is irrelevant. for example, the limitation of form submission and frequency all require the client IP address information. Use the code snippet in the popular Discuz X2.5 file source/class/discuz/discuz_application.php:

Private function _ get_client_ip (){

$ Ip = $ _ SERVER ['remote _ ADDR '];

If (isset ($ _ SERVER ['http _ CLIENT_IP ']) & preg_match ('/^ ([0-9] {1, 3 }\.) {3} [0-9] {1, 3} $/', $ _ SERVER ['http _ CLIENT_IP']) {

$ Ip = $ _ SERVER ['http _ CLIENT_IP '];

This program code has the "IP address forgery" vulnerability. how can this problem be solved?

 

 

Front-end technology

1. ajax does not support cross-top-level domain names. what methods should I use to obtain cross-domain ajax data?

2. are you familiar with jquery?

3. Why is the json format popular in ajax applications?

 

 

Integrated technology

  1. 1. has memcache been used ?, Is it distributed on the client or server?
  2. 2. have you used version control tools (such as SVN )? What is its role?
  3. 3. have you written the php cli program?
  4. 4. how to deal with the paging of large data tables (for example, using mysql limit for a data table containing tens of millions of records may have poor performance )?
  5. 5. What are the common architecture technologies of large-traffic websites?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.