標題:

php一問

發問:

我想問下php有冇d function 等同asp 既 redirect??

最佳解答:

header (PHP 3, PHP 4 , PHP 5) header -- Send a raw HTTP header Description void header ( string string [, bool replace [, int http_response_code]]) ..... header() is used to send raw HTTP headers. See the HTTP/1.1 specification for more information on HTTP headers. ...... The second special case is the "Location:" header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless some 3xx status code has already been set. <?php header(”Location: http://www.example.com/”); /* Redirect browser *// /* Make sure that code below does not get executed when we redirect. */ exit; ?> Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

其他解答:

此文章來自奇摩知識+如有不便請留言告知

7638E7481407D16B

arrow
arrow
    創作者介紹
    創作者 dvhtlbz 的頭像
    dvhtlbz

    dvhtlbz的部落格

    dvhtlbz 發表在 痞客邦 留言(0) 人氣()