我有这段代码来检查是否有任何输入值为空,但由于某种原因,页面不断吐出500错误(即使有错误报告,它也只会给我500错误。)
这是我的代码
PHP
function checkInput() {
echo 'There are one or more errors with your application';
if (empty($_POST['MINGNAME'])) {
die('Please fill in your in-game name<br>');
} elseif (empty($_POST['MSTEAMID'])) {
die('Please fill in your Steam-ID ( by signing in through Steam )<br>');
} elseif (empty($_POST['MAGE'])) {
die('Please fill in your age<br>')
} elseif (empty($_POST['MULX1'])) {
die('Please fill out the first ULX command<br>');
} elseif (empty($_POST['MULX2'])) {
die('Please fill out the second ULX command<br>');
} elseif (empty($_POST['MULX3'])) {
die('Please fill out the third ULX command<br>');
} elseif (empty($_POST['MULX4'])) {
die('Please fill out the fourth ULX command<br>');
} elseif (empty($_POST['MULX5'])) {
die('Please fill out the fifth ULX command<br>');
} elseif (empty($_POST['MSIT1'])) {
die('Please fill out your first situational<br>');
} elseif (empty($_POST['MSIT2'])) {
die('Please fill out your second situational<br>');
} elseif (empty($_POST['MSIT3'])) {
die('Please fill out your third situational<br>');
} elseif (empty($_POST['MSIT4'])) {
die('Please fill out your fourth situational<br>');
} elseif (empty($_POST['MSIT5'])) {
die('Please fill out your fifth situational<br>');
} else {
echo '';
}
}
checkInput();
我不知道我的代码有什么问题。 任何帮助将不胜感激。
答案 0 :(得分:3)
你在第10行丢失了分号:
} elseif (empty($_POST['MAGE'])) {
die('Please fill in your age<br>') /* Here */
答案 1 :(得分:0)
之后没有分号:
die('Please fill in your age<br>')
如果您没有显示500 Internal Server Error
,这将导致PHP解释器发送display_errors
。