PHP interview questions & lt; 1 & gt; recent things are disorganized, and I have no peace of mind to work. I have no time to summarize some PHP interview questions. 1. The difference between the get and post submission methods in the form. The get client adds data to the url, such as submit. php? Id = 123 & amp; name = yanggong, so that get has certain PHP interview questions <一>
Recent events are disorganized. if you don't feel at ease, you can summarize some PHP interview questions.
1. differences between get and post submission methods in forms
The get client adds data to the url, such as submit. php? Id = 123 & name = yanggong, so that get has certain security problems.
The small amount of data transmitted by get is mainly because of the limited url length, while post can transmit a large amount of data.
Get limits the range of datasets in the form. post supports the entire iso000046 character set.
2. differences between session and cookie
Cookie is the information stored on the client. it is a mechanism that allows remote browsers to store data and track and identify users. The http header of PHP sends cookies. Therefore, the setcookie () function must be called before other information is sent out, which is similar to the header () function.
Session is the information stored on the server. From this perspective, session is safer than cookie. When a session is created, the server returns the client's encrypted session_id to identify the user, close the browser, and destroy the session, so that the value of the session is lost.
3. echo print ?? Differences between print_r printf
Echo is a php statement with no return value. it outputs one or more
Print () and print_r () are functions that return values. Print prints simple type variables, while print_r () can print array objects like complex variables.
The printf () function outputs formatted strings.
4. differences between mysql_fetch_array () and mysql_fetch_row ()
Mysql_fetch_array () returns an array generated based on the rows obtained from the result set. If no more rows exist, false is returned .?? You can Index data by field name or number.
Mysql_fetch_row () returns a result set to obtain a row as an enumerated array, and returns the data of a number. The offset is 0, and only digits can be indexed.
5. basic PHP object-oriented knowledge ???? _ Set () _ get () _ construct ()?? Public private protected
_ Set ()?? Used to set the attribute value
_ Get ()?? Get attribute value
_ Construct ?? Only one constructor can be declared in a class. each time you create an object, you can call the constructor once. you cannot actively call this method. Therefore, you usually use this method to execute some useful initialization tasks.
Public indicates global and can be accessed by external subclass inside the class.
Private indicates private, which can be called only within this class.
Protected indicates that it is protected and can be accessed only by this class, subclass, or parent class.
6. Talk about transactions?
A transaction is a series of operations that complete a task. if one of these operations fails, the transaction fails. a rollback event occurs, that is, the previous operation is revoked, this ensures data consistency. In addition, you can temporarily store the operation in the cache and wait until all the operations are successfully submitted to the database. This ensures that the time-consuming operations are all effective operations.