Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use base HTTP Authentication in php

Shulou Source: shulou.com Published: 2022-06-03 19:44:25 11月12日 Update

This article will explain in detail how to use base HTTP verification in php. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

The details are as follows:

Function http_auth ($un, $pw, $realm= "Secured Area") {if (! (isset ($_ SERVER ['PHP_AUTH_USER']) & & isset ($_ SERVER [' PHP_AUTH_PW']) & & $_ SERVER ['PHP_AUTH_USER'] = = $un & & $_ SERVER [' PHP_AUTH_PW'] = = $pw)) {header ('WWW-Authenticate: Basic realm= "$realm'); header ('Status: 401Unauthorized'); exit () }} this is the end of the article on "how to use base HTTP Verification in php". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Articles verification more good practical content articles knowledge reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS MariaDB Huawei Microsoft