http_response_code Get or Set the HTTP response code php函数


http_response_code

(No version information available, might only be in SVN)

http_response_codeGet or Set the HTTP response code

说明

int http_response_code ([ int $response_code ] )

If you pass no parameters then http_response_code will get the current status code. If you pass a parameter it will set the response code.

参数

response_code

The optional response_code will set the response code.

<?php
http_response_code
(404);
?>

返回值

The current response code. By default the return value is int(200).

范例

Example #1 Examples using headers_list()

<?php

// Get the current default response code
var_dump(http_response_code()); // int(200)

// Set our response code
http_response_code(404);

// Get our new response code
var_dump(http_response_code()); // int(404)
?>

以上例程会输出:

参见

  • header() - Send a raw HTTP header
  • headers_list() - Returns a list of response headers sent (or ready to send)



相关阅读:
hypot 计算一直角三角形的斜边长度
ibase_add_user Add a user to a security database (only for IB6 or later)
ibase_affected_rows Return the number of rows that were affected by the previous query
ibase_backup Initiates a backup task in the service manager and returns immediately
ibase_blob_add Add data into a newly created blob
ibase_blob_cancel Cancel creating blob
ibase_blob_close Close blob
ibase_blob_create Create a new blob for adding data
ibase_blob_echo Output blob contents to browser
ibase_blob_get Get len bytes data from open blob
ibase_blob_import Create blob, copy file in it, and close it
ibase_blob_info Return blob length and other useful info
ibase_blob_open Open blob for retrieving data parts
ibase_close Close a connection to an InterBase database
快速导航

Copyright © 2016 phpStudy |