How can I get a user's input when using htaccess/htpasswd?
问题 I want to create a log in system using htaccess and htpasswd file and PHP for the server-side code, but when the user logs in I want to be able to identify that user, so how can I know what the user typed in as their username using PHP code (I assume I won't need to know the password if they've managed to access the restricted page)? Many thanks, Ben 回答1: You just need the following to get the username that is currently in use for an authenticated session: $_SERVER['PHP_AUTH_USER'] rev1 In