HTTP status code returned by php

Source: Internet
Author: User
When php returns an HTTP status code for the interview, many people ask me this and record it ??? 200 is OK ,?? 404 indicates that the. HTTP protocol status code is not found on the page. when calling a function, you only need to assign $ num to a known value in the following table to directly return the status. & Lt ;? PHP? /**? *? HTTP? Protocol? Defined? Status? Codes *? HTTP status code returned by the php protocol
During the interview, many people asked me this question and recorded it ??? 200 is OK ,?? 404 indicates that the page is not found.
HTTP status code. when calling a function, you only need to assign $ num to a known value in the following table and then return the status directly.
/**?
*? HTTP? Protocol? Defined? Status? Codes
*? HTTP status code. when calling a function, you only need to assign $ num to a known value in the following table and then return the status directly.
*? @ Param? Int? $ Num
*/?
Function? Https ($ num )? {?
$ Http? =? Array? (?
100? =>? & Quot; HTTP/1.1? 100? Continue ",?
101? =>? & Quot; HTTP/1.1? 101? Switching? Protocols ",?
200? =>? & Quot; HTTP/1.1? 200? OK ",?
201? =>? & Quot; HTTP/1.1? 201? Created ",?
202? =>? & Quot; HTTP/1.1? 202? Accepted ",?
203? =>? & Quot; HTTP/1.1? 203? Non-Authoritative? Information ",?
204? =>? & Quot; HTTP/1.1? 204? No? Content ",?
205? =>? & Quot; HTTP/1.1? 205? Reset? Content ",?
206? =>? & Quot; HTTP/1.1? 206? Partial? Content ",?
300? =>? & Quot; HTTP/1.1? 300? Multiple? Choices ",?
301? =>? & Quot; HTTP/1.1? 301? Moved? Permanently ",?
302? =>? & Quot; HTTP/1.1? 302? Found ",?
303? =>? & Quot; HTTP/1.1? 303? See? Other ",?
304? =>? & Quot; HTTP/1.1? 304? Not? Modified ",?
305? =>? & Quot; HTTP/1.1? 305? Use? Proxy ",?
307? =>? & Quot; HTTP/1.1? 307? Temporary? Redirect ",?
400? =>? & Quot; HTTP/1.1? 400? Bad? Request ",?
401? =>? & Quot; HTTP/1.1? 401? Unauthorized ",?
402? =>? & Quot; HTTP/1.1? 402? Payment? Required ",?
403? =>? & Quot; HTTP/1.1? 403? Forbidden ",?
404? =>? & Quot; HTTP/1.1? 404? Not? Found ",?
405? =>? & Quot; HTTP/1.1? 405? Method? Not? Allowed ",?
406? =>? & Quot; HTTP/1.1? 406? Not? Acceptable ",?
407? =>? & Quot; HTTP/1.1? 407? Proxy? Authentication? Required ",?
408? =>? & Quot; HTTP/1.1? 408? Request? Time-out ",?
409? =>? & Quot; HTTP/1.1? 409? Conflict ",?
410? =>? & Quot; HTTP/1.1? 410? Gone ",?
411? =>? & Quot; HTTP/1.1? 411? Length? Required ",?
412? =>? & Quot; HTTP/1.1? 412? Precondition? Failed ",?
413? =>? & Quot; HTTP/1.1? 413? Request? Entity? Too? Large ",?
414? =>? & Quot; HTTP/1.1? 414? Request-URI? Too? Large ",?
415? =>? & Quot; HTTP/1.1? 415? Unsupported? Media? Type ",?
416? =>? & Quot; HTTP/1.1? 416? Requested? Range? Not? Satisfiable ",?
417? =>? & Quot; HTTP/1.1? 417? Expectation? Failed ",?
500? =>? & Quot; HTTP/1.1? 500? Internal? Server? Error ",?
501? =>? & Quot; HTTP/1.1? 501? Not? Implemented ",?
502? =>? & Quot; HTTP/1.1? 502? Bad? Gateway ",?
503? =>? & Quot; HTTP/1.1? 503? Service? Unavailable ",?
504? =>? & Quot; HTTP/1.1? 504? Gateway? Time-out "??
);?
Header ($ http [$ num]);?
}?
?> @header( 'HTTP/1.0?404?Not?Found' );?????

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.