"Go" php basic knowledge point

Source: Internet
Author: User
"Go" php basic knowledge point

Original address: http://blog.csdn.net/hyslx27/article/details/6180028

?

?

1. The meaning of several status codes in the HTTP protocol: 503 500 401 200 301 302.
??? HTTP status Code

??? 1**: Request received, continue processing
??? 2**: Successful operation received, analysis, acceptance
??? 3**: Completion of this request must be further processed
??? 4**: request contains an error syntax or cannot be completed
??? 5**: The server failed to perform a fully valid request

??? 500--Server generates internal error
??? 501--server does not support the requested function
??? 502--server is temporarily unavailable, sometimes to prevent system overloads
??? 503--server overload or pause repair

??? 400--error requests, such as syntax errors
??? 401--Request Authorization failed
??? 403--Request not allowed

??? 200--Trading Success
??? 201--prompt to know the URL of the new file
??? 202--accepted and processed, but processing not completed
??? 203--return information is indeterminate or incomplete
??? 204--request received, but return information is empty
??? 205--the server has completed the request, the user agent must reset the files that are currently viewed
??? 206--server has completed a partial user's GET request

??? 300--requested resources can be obtained in multiple places
??? 301--Delete request data
??? 302--found the request data at a different address


?? 2. Include require include_once require_once the difference.

??? The include (), require () statement contains and runs the specified file. The two structures are exactly the same on the containing file, and the only difference is the handling of the errors. The require () statement stops when the containing file does not exist or is faulted, and an error is encountered. The include () continues.
??? Include_once (), like require_once (), should be used to make sure it is included only once to avoid problems such as function redefinition, variable re-assignment, and so on, when the same file is likely to be included more than once during script execution. This is the main difference between include_once () and require_once () and include () and require ().

?? 3. Evolutionary history of several versions of Php/mysql, such as mysql4.0 to 4.1,php 4.x to 5.1 , etc.

? ? 4. Heredoc Introduction

??? Heredoc is one that allows us to implement a large section of HTML code within the PHP code, and in which we can use PHP variables.
??? 1. <<<>
??? 2. Variables located between the opening and closing tags can be parsed normally, but the function is not.
??? 3.heredoc is often used when the output contains a large number of HTML syntax D documents. For example: function outputhtml () to output the HTML home page. There are two ways to do this. Obviously the second is simpler and easier to read.


?? 5. Write some magic methods for PHP;


__construct Initializing constructors
__destruct unload Destructors
__autoload Auto Load function
__call?? The method that calls the function of a nonexistent class, __call fails, calls the parent class method, and so on
__get?? Get property value
__set ()?? Setting property values
__isset () Determine whether a variable is set with a function, pass in a variable as a parameter, return TRUE if the passed-in variable exists, or return false
__unset () deletes the specified variable and returns True, with the argument being the variable to be deleted.
__clone ();?? Cloning objects
__tostring (); To convert a type of object
__sleep ();???
__wakeup ();
When an object is serialized, PHP invokes the __sleep method (if one exists). After crossdress an object, PHP calls the __wakeup method. Both methods do not accept parameters. The __sleep method must return an array containing the properties that need to be serialized.

?? 6. Some configure parameters when compiling PHP

?? 7. Two methods of passing parameters to PHP.


??? When a function is called, arguments are passed to the function, the arguments passed in are called arguments, and the arguments to the function definition are formal parameters. There are two ways to pass a parameter.
??? 1. Pass Value: Copy the value of the argument to the corresponding parameter, the operation inside the function is for the parameter, the result of the operation does not affect the argument, that is, after the function returns, the value of the argument does not change.
??? 2. Address mode: The memory addresses of the arguments are passed to the formal parameter, and all operations inside the function affect the value of the argument, that is, the value of the argument changes accordingly. You only need to add the & number to the parameter before you pass the address.


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


??? The value that varchar holds is variable length, char is fixed length, and if the saved value is less than the length you define, SQL appends a space to it until you define the field length.


?? 9. Use of debug functions such as Error_reporting


??? The error_reporting () function is a function used to redefine the page display error level, which can override the php.ini configuration for the program runtime error reporting level.
The error_reporting () function can use the parameter list and the numeric values of these parameters:

Value constants
1 E_error

2 e_warning

4 E_parse

8 E_notice

E_core_error

E_core_warning

E_compile_error

E_compile_warning

E_user_error

E_user_warning

1024x768 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.