Advanced php interview questions and some answers

Source: Internet
Author: User
I saw some advanced php interview questions on the internet ...... I got some answers ...... It may not be comprehensive. Leave it for future use. I. Basic knowledge point 1.1The meaning of several status codes in the HTTP protocol: 503500401403404200301302 ...... 200: the request is successful, and the requested data is returned accordingly. 301: Permanent redirection. 3

I saw some advanced php interview questions on the internet ...... I got some answers ...... It may not be comprehensive. Leave it for future use. I. Basic knowledge point 1.1 meaning of several status codes in HTTP: 503 500 401 403 404 200 301 ...... 200: the request is successful, and the requested data is returned accordingly. 301: Permanent redirection. 3

I saw some advanced php interview questions on the internet ......

I got some answers ...... It may not be comprehensive. Leave it for future use.

I. Basic knowledge point

1.1 meaning of several status codes in HTTP: 503 500 401 403 404 200 301 302 ......

200: the request is successful, and the requested data is returned accordingly.

301: Permanent redirection.

302: Temporary row redirection.

401: the current request requires user verification.

403: the server does not have the permission to execute the request.

404: The request failed. The request data is not found on the server.

500: server error. Generally, the server program execution is incorrect.

503: temporary server maintenance or overload. This status is temporary.

1.2 Include require include_once require_once.

Different Processing failure methods:

When require fails, a fatal error is generated and the program is stopped.

When the include operation fails, only one warning error is generated, and the program continues to run.

Include_once/require_once and include/require handle errors in the same way,

The only difference is that when the included file code already exists, it is not included.

History of several versions in 1.3 PHP/Mysql, such as major improvements from mysql4.0 to 4.1 and from PHP 4.x to 5.1.

1.4 HEREDOC Introduction

A method for defining strings.

Structure:

<. At the end of the prompt, you must define an identifier (a single line ),

Then there is a new line. Next is the string itself,

Finally, use the identifier defined above as the end sign (a separate row)

Note:

It can only contain letters, numbers, and underscores, and must begin with a letter or underscore

1.5 write some php magic methods;

_ Construct () is automatically called when the class is instantiated.

The _ destruct () Class Object is automatically called when it is used.

_ Set () is called when an undefined attribute is assigned a value.

_ Get () is called when an undefined attribute is called.

_ Isset () is called when isset () or empty () functions are used.

_ Unset () is called when unset () is used.

_ Sleep () is called when serialize is used for serialization.

_ Wakeup () is called when unserialize is used for deserialization.

_ Call () is called when a nonexistent method is called.

_ CallStatic () calls a non-existent static method.

_ ToString () is called when the object is converted to a string. For example, echo.

_ Invoke () is called when an object is called as a method.

_ Set_state () is called when var_export () function is used. Accept an array parameter.

_ Clone () is called when clone is used to copy an object.

1.6 some configure parameters for php Compilation

? Prefix =/usr/local/php installation directory

? With-config-file-path =/usr/local/php/etc specify the php. ini location

? With-mysql =/usr/local/mysql installation directory, support for mysql

? With-mysqli =/usr/local/mysql/bin/mysql_config mysqli file directory, optimized support

? Enable-safe-mode: enable safe mode

? Enable-ftp support for enabling ftp

? Enable-zip supports zip

? With-bz2 opens support for bz2 files

? With-jpeg-dir open support for jpeg images

? With-png-dir open support for png Images

? With-freetype-dir open freetype library support

? Without-iconv disable the iconv function and convert between character sets.

? Support for opening libxml2 library with-libxml-dir

? With-xmlrpc open the C language of xml-rpc

? With-zlib-dir supports opening the zlib library

? With-gd supports opening the gd library

For more information, see./configure help.

1.7 three methods for passing parameters to php.

/*

* Method 1 use $ argc $ argv

* Run/usr/local/php/bin/php./getopt. php-f 123-g 456 in the command line.

*/

// If ($ argc> 1 ){

// Print_r ($ argv );

//}

/**

* Running result

*

Sync @ MySUSE11 :~ /Web_app/channel3/interface>/usr/local/php/bin/php./getopt. php-f 123-g 456

Array

(

[0] =>./getopt. php

[1] =>-f

[2] => 123.

[3] =>-g

[4] = & gt; 456

)

*/

/*

* Method 2 use the getopt function ()

* Run/usr/local/php/bin/php./getopt. php-f 123-g 456 in the command line.

*/

// $ Options = "f: g :";

// $ Opts = getopt ($ options );

// Print_r ($ opts );

/**

* Running result

*

Sync @ MySUSE11 :~ /Web_app/channel3/interface>/usr/local/php/bin/php./getopt. php-f 123-g 456

Array

(

[F] = & gt; 123

[G] = & gt; 456

)

*/

/*

[1] [2]

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.