我是PHP新手,我面临语法错误。PHP解析语法错误
代码:
<?php
// configuration
require("../includes/config.php");
// if form was submitted
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if(empty($_POST['username'])) || empty($_POST['password'] || $_POST['password'] != $_POST['confirmation']){
apologize('You did something wrong!');
}
}
else
{
// else render form
render("register_form.php", ["title" => "Register"]);
}
?>
错误:
Parse error: syntax error, unexpected '||' (T_BOOLEAN_OR), expecting ')' in /home/jharvard/vhosts/localhost/html/register.php on line 9
我很新的PHP,这是可能的这段代码有多个错误。 作为参考,道歉只是简单地渲染一个抱歉的消息以及额外的输入,渲染只是一个简化渲染过程的模板。
'如果(空($ _ POST [ '名']))'你有一个额外的括号封闭的if语句 – Pankrates 2013-04-10 14:47:53
感谢,定了! – 2013-04-10 14:49:45
PHP错误几乎总会给你足够的信息来发现问题。如果你学会阅读错误,你永远不会有语法问题。 – Narek 2013-04-10 14:50:01