当前的形式使可读性更难,它应该是:
if (isset($_POST['doRegCheck'])):
if (intval($_POST['doRegCheck']) == 0 || empty($_POST['doRegCheck'])):
redirect_to("index.php?do=users");
endif;
endif;
翻译为:
if (isset($_POST['doRegCheck'])){
if (intval($_POST['doRegCheck']) == 0 || empty($_POST['doRegCheck'])){
redirect_to("index.php?do=users");
}
}
意义:
//is $_POST['doRegCheck'] set
if (isset($_POST['doRegCheck'])){
//intval will return (int)0 even if its abc,
// perhaps it should be is_numeric() as it will
// pass if the value is 0 or the value is abc or empty
if (intval($_POST['doRegCheck']) == 0 || empty($_POST['doRegCheck'])){
//some user function to redirect
redirect_to("index.php?do=users");
}
}