get_http_origin

函式
get_http_origin ( No parameters )
返回值
  • (string) URL of the origin. Empty string if no origin.
定義位置
相關方法
get_allowed_http_originsis_allowed_http_originget_the_author_loginget_pluginsget_to_ping
引入
3.4.0
棄用
-

get_http_origin: 這個函式用來檢索HTTP Origin頭的值,它用於識別跨源請求的來源。這對於保證網站免受跨站指令碼攻擊很有用。

獲取當前請求的HTTP原點.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_http_origin() {
$origin = '';
if ( ! empty( $_SERVER['HTTP_ORIGIN'] ) ) {
$origin = $_SERVER['HTTP_ORIGIN'];
}
/**
* Change the origin of an HTTP request.
*
* @since 3.4.0
*
* @param string $origin The original origin for the request.
*/
return apply_filters( 'http_origin', $origin );
}
function get_http_origin() { $origin = ''; if ( ! empty( $_SERVER['HTTP_ORIGIN'] ) ) { $origin = $_SERVER['HTTP_ORIGIN']; } /** * Change the origin of an HTTP request. * * @since 3.4.0 * * @param string $origin The original origin for the request. */ return apply_filters( 'http_origin', $origin ); }
function get_http_origin() {
	$origin = '';
	if ( ! empty( $_SERVER['HTTP_ORIGIN'] ) ) {
		$origin = $_SERVER['HTTP_ORIGIN'];
	}

	/**
	 * Change the origin of an HTTP request.
	 *
	 * @since 3.4.0
	 *
	 * @param string $origin The original origin for the request.
	 */
	return apply_filters( 'http_origin', $origin );
}

常見問題

FAQs
檢視更多 >