php page jump code enter url jump to the page you defined

  • 2020-05-30 19:43:10
  • OfStack

The code is simple and involves the use of the header function, as shown below
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) { 
$uri = 'https://'; 
} else { 
$uri = 'http://'; 
$uri .= $_SERVER['HTTP_HOST']; 
header('Location: '.$uri.'/demo/'); 

Code explanation: I will first check whether you have opened https. If so, it will be normal https page. If not, it will jump to the directory under the project

Related articles: