PHP Basics-php Tutorial

Source: Internet
Author: User
[Switch] PHP basic knowledge point original address: blog. csdn. nethyslx27articledetails6180028 ?? 1. meaning of several status codes in HTTP: 503500401200301302 .??? HTTP status code ??? 1 **: The request is received. continue processing ??? 2 **: The operation is successfully received, analyzed, and accepted ??? 3 **: complete this request [to] basic PHP knowledge points

Address: http://blog.csdn.net/hyslx27/article/details/6180028

?

?

1. meaning of several status codes in HTTP: 503 500 401 200 301 302.
??? HTTP status code

??? 1 **: request received, continue processing
??? 2 **: The operation is successfully received, analyzed, and accepted.
??? 3 **: The request must be further processed.
??? 4 **: The request contains an error syntax or cannot be completed
??? 5 **: The server failed to execute a fully valid request.

??? 500 -- Internal error occurred on the server
??? 501 -- the server does not support the requested function
??? 502 -- the server is temporarily unavailable, sometimes to prevent system overload
??? 503 -- server overload or service suspension

??? 400 -- Incorrect request, such as syntax error
??? 401 -- authorization request failed
??? 403 -- the request is not allowed

??? 200 -- Transaction successful
??? 201 -- prompt to know the URL of the new file
??? 202 -- accept and process, but not complete
??? 203 -- the returned information is uncertain or incomplete
??? 204 -- the request is received, but the returned information is null.
??? 205 -- when the server completes the request, the user agent must reset the file that has been browsed.
??? 206 -- the server has completed some users' GET requests

??? 300 -- the requested resources can be obtained in multiple places
??? 301 -- delete request data
??? 302 -- request data found at other addresses


?? 2. Differences Between Include require include_once require_once.

??? Include () and require () statements include and run the specified file. The two structures are exactly the same on the contained files, and the only difference is the handling of errors. When the require () statement encounters an error or the contained file does not exist, it stops and returns an error. Include () indicates that the row is continued.
??? Include_once () and require_once () should be used when the same file may be contained more than once during script execution, make sure it is included only once to avoid the problem of function redefinition and variable re-assignment. This is the main difference between include_once () and require_once () and include () and require.

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

? ?4. HEREDOC introduction

??? HeredocIs to allow us to implement a large segment of html code in php code, and you can use php variables in it.
??? 1. use <
??? 2. variables between the start tag and the end tag can be parsed normally, but functions cannot.
??? 3. heredoc is often used to output a large number of HTML syntax d documents. For example, the outputhtml () function outputs the HTML homepage. There can be two writing methods. Obviously, the second method is relatively simple and easy to read.


??5. write some php magic methods;


_ Construct initialization constructor
_ Destruct uninstall the destructor
_ Autoload: automatically loaded functions
_ Call ?? When calling a function of a non-existing class, you have to handle this problem. if the call fails, the parent class method is called.
_ Get ?? Get attribute value
_ Set ()?? Set attribute values
_ Isset () is used to determine whether a variable is set. a variable is input as a parameter. if the input variable exists, true is returned; otherwise, false is returned.
_ Unset (): delete the specified variable and return true. the parameter is the variable to be deleted.
_ Clone ();?? Clone object
_ ToString (); converts object types
_ Sleep ();???
_ Wakeup ();
When an object is serialized, PHP calls the _ sleep method (if any ). after an object is deserialized, PHP calls the _ wakeup method. both methods do not accept parameters. the _ sleep method must return an array containing the attributes to be serialized.

??6. some configure parameters for php compilation

??7. two methods for passing parameters to php.


??? When calling a function, you need to pass parameters to the function. the passed parameters are called real parameters, and the function-defined parameters are form parameters. There are two ways to pass parameters.
??? 1. value passing method: Copy the value of a real parameter to the corresponding parameter. The operation in the function is performed on the parameter. The operation result does not affect the real parameter. after the function returns, the value of the real parameter will not change.
??? 2. address transfer method: the memory address of the real parameter is transferred to the form parameter. all operations in the function will affect the value of the real parameter. that is, after the result is returned, the value of the real parameter will change accordingly. You only need to add an ampersand (&) before the parameters.


??8. (mysql) please write out the meaning of the data type (int char varchar datetime text); what is the difference between varchar and char;


??? The value saved by Varchar is a variable length, and CHAR is a fixed length. if the saved value is less than the defined length, the SQL statement will append spaces to the end until the field length you define.


??9. Use of error_reporting and other debugging functions


??? Error_reporting () is a function used to redefine the page display error level. This function can overwrite the PHP. ini configuration for the error report level when the program is running.
The list of parameters that can be used by the error_reporting () function and the numeric values of these parameters:

Value constant
1 E_ERROR

2 E_WARNING

4 E_PARSE

8 E_NOTICE

16 E_CORE_ERROR

32 E_CORE_WARNING

64 E_COMPILE_ERROR

128 E_COMPILE_WARNING

256 E_USER_ERROR

512 E_USER_WARNING

1024 E_USER_NOTICE

2047 E_ALL

2048 E_STRICT

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.