Home >Backend Development >PHP Problem >How to get the real url after jump in php
php method to get the real url after the jump: You can use the get_headers() function to get it. The get_headers() function is a system-level function that returns an array containing the headers sent by the server in response to an HTTP request.
get_headers() is a system-level function in PHP that returns an array containing the headers sent by the server in response to an HTTP request. If it fails, it returns FALSE and issues an E_WARNING level error message (which can be used to determine whether the remote file exists).
(Recommended tutorial: php graphic tutorial)
Function syntax:
array get_headers ( string $url [, int $format = 0 ] )
Parameters:
url Required. Target URL
format Optional. If it is 1, parse the corresponding information and set the array key name.
(Learning video recommendation: php video tutorial)
Code implementation:
$headers = get_headers('将跳转的URL'); if ($headers && $headers['Location']){ echo $headers['Location']; }
The above is the detailed content of How to get the real url after jump in php. For more information, please follow other related articles on the PHP Chinese website!