简单的问题(我希望)。
目前我正在使用以下代码:
mysql_query($sql) or header("Location: /error");
为了防止脚本的其余部分运行,我需要添加exit;
or die()
。有没有办法使用上面的内联方法来做到这一点,或者我需要使用:
$result = mysql_query($sql);
if (!result) {
header("Location: /error");
exit();
}
Thanks
怎么样:
function customDie($location) {
header('Location: ' . $location);
exit();
}
mysql_query($sql) or customDie("/error");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)