分析错误:语法错误,第18行的C:\\wamp64\\www\\Proiect\\aplicatie\\user_check.php中出现意外的‘}’

时间:2020-05-18 作者:Ralu
//register users

$username= mysqli_real_escape_string($db, $_POST[\'username\']);
$email= mysqli_real_escape_string($db, $_POST[\'email\']);
$password1= mysqli_real_escape_string($db, $_POST[\'password1\']);
$password2= mysqli_real_escape_string($db, $_POST[\'password2\']);

//form validation

if(empty($username)){array_push($errors, "Username is required")};
if(empty($email)) {array_push($errors, "Email is required")};
if(empty($password)) {array_push($errors, "Password is required")};
1 个回复
SO网友:Rup

分号需要进入花括号内,以标记array\\u push()语句的末端:

if(empty($username)) { array_push($errors, "Username is required"); }
if(empty($email)) { array_push($errors, "Email is required"); }
if(empty($password)) { array_push($errors, "Password is required"); }
紧闭的大括号后不需要分号。

相关推荐

如何使用php更改内容宽度?

我已经使用php创建了一个自定义模板,想知道如何修改内容宽度?我是否必须在php中创建一个类,然后使用CSS修改宽度?这就是我的php模板现在的样子:<?php /* Template Name: NewEventTemplate */ ?> <?php /** * The template for displaying pages. * * @package Salient WordPress Theme * @version