Regarding the problem of defined('AUTH')
益伦
益伦 2017-10-12 19:14:40
0
1
1359

<?php

//If the AUTH constant exists for defined('AUTH'), it is true and the subsequent exit will not be accessed. If it is false, execute exit

defined('AUTH') or exit('Access is not allowed due to security factors');

?>

Why output Result: Access is not allowed due to security reasons? The constant AUTH has no value assigned. How can I directly treat it as false and execute exit? ?



益伦
益伦

reply all(1)
寻觅 beyond
<?php
if(!defined('AUTH')){
	exit("不准访问....")
}
?>

The above code is equivalent to yours.

The comment you wrote is correct, but your question seems to be contrary to your comment. You first need to understand that there is a short-circuit theorem. There are two conditions a or b. If a is true, it will not continue to judge whether b is true. Only when a is false, it will judge whether b is true. defined() is equivalent to a, and exit() is equivalent to b. You have already said that AUTH has no value assigned, then defined is false, and exit() is judged, and exit() is always true, so exit() is executed

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template