首页 > 解决方案 > 括号在 PHP 代码中丢失

问题描述

解析错误:语法错误,意外的“{”

Lz,我想知道你能帮帮我吗,我找不到。

if( isPost() ) {
    extract($_POST);
    if( validation_required([$name , $family ,$username , $email , $password]) ) {
        $conn = connectToDB();
        if (!userGet($username,$conn){
             saveUsers($_POST) ? redirect("index.php") : $status = 'you are failed';
        } else {
            $status = "This username is exist";
        }
    } else {
        $status = 'your information is not valid';
    }
}

标签: phpif-statement

解决方案


这是第 5 行:

if (!userGet($username,$conn){

应该有 2 个右括号

if (!userGet($username,$conn)){

推荐阅读