<?PHPerror_reporting(E_all);/*PHP 5.3 Introduces lazy static bindings*//*php5.4 introduced trait, used to implement multilayer inheritance trait hello{} trait world{} class myhelloworld{use Hello,world;}*//*php4 times PHP is not a destructor-capable*//*The array index in PHP is a string, but without using quotation marks, PHP considers it a constant and cannot find a variable*//** * PHP exceptions must be manually * can be combined with error handling mechanism to let PHP automatically throw exceptions * Set_error_handler (error_function,e_all| E_STRICT)//default E_all inverse function Restore_error_handler (); * Fetal error or register_shutdown_function error_get_last () at the end of the program; *//*try {} catch (Typeexception $e) {} catch (Pdoexception $e) {} catch (Exception $ex) {//exception handling}*//*the principle of object-oriented design single-accused interface isolation leaving closed principle substitution principle dependency inversion (upper module cannot rely on lower layer, abstract cannot depend on concrete)*//*PHP has two sets of regular expressions 1, functions provided by the Pcre (Perl Compatible Regular Expression) library, beginning with ' Preg_ ' 2, by POSIX (protable Operating System Int Erface of Unix [UNIX Portable Operating System interface], which defines the underlying regular expressions and extended regular expressions) extension provides functions that begin with ' Ereg_ ' [.!?] do not need to escape * assert * order sure to look around (? =exp) * Reverse view (? <= EXP) * Order negative surround look (?! EXP) * Reverse negation surround (? <!exp) * * Regular priority * \ escape Character * () (?:) (?=) (? <=) (?!) (? <!) [] Brackets and brackets *? + * {N,m} qualifier * ^ $ DSDSDF locator and sequence * | Replace * M|foot (M|F) oot * * Regular expression Common mode * I ignore case * M multiline match pattern * s Point pass pattern * U lazy Match pattern * D end Limit ' abc\n '/abc//abc/d * u Support for utf-8 escape expression [\x{4e00}-\x{9fa5}] * x ignore whitespace in expression * * efficiency * FILTER_VAR ($email, Filter_validate_email) * Filter_var ($url, filter _validate_url)*//** * 1XX hint Information--request to accept, continue processing * 2xx Success * 3xx Redirect--to complete the request must be further action * 4xx client Error * 5XX Service side Error * * OK * * Request Customer End Request syntax error, cannot be understood by server * 401 Unauthorize request Unauthorized * 403 Forbidden * 404 Not Found * Internal Server error Server unpredictable error * 503 Server Unavailabel Server is currently unable to process client requests and may return to normal after some time*//** * SPAM defense measures * IP Restrictions * Get client IP method??? * Verification Code * Token * Createtoken Verifytoken * Audit mechanism*//** * CURL * $ch =curl_init () * curl_setopt ($ch, OPTIONS) * $output =curl_exec ($ch); *//$info =curl_getin Fo ($ch); * Curl_close ($ch) * OPTIONS: * curlopt_url * curlopt_returntransfer * curlopt_header * curlopt_post * CURLOPT_POSTFI ELDs * curl_setopt ($ch, Curlopt_postfields,array (' foo ' = ' bar)]; *//Upload file * curl_setopt ($ch, Curlopt_postfields,array (' foo ' = ' bar ', ' upload ' + ' @test. jpg ')); * Curlopt_httpheader * curl_setopt ($ch, Curlopt_httpheader,array (' http_accept://... ', ')); * Curlopt_cookiejar, set cookie saved file * curl_setopt ($ch, Curlopt_cookiejar,tempnam ('/tmp ', ' prefix ')); * Curlopt_cookiefile Specifies the filename to obtain the cookie * curl_setopt ($ch, Curlopt_cookiefiel, '/tmp/prefix3243234326,tmp '); * Curlopt_cookie Set COOKIE * curl_setopt ($ch, Curl_cookie, ' name=jimmy '); * *//** * SOCKET * OB*/Session_Start();Print_r($_session);//$_session[' name ']= ' Jimmy ';//setcookie (Session_name (), session_id (), Time () +3600, '/');?>