php 怎么了?PHP解析错误:语法错误,意外的'}',需要','或';' 在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40742638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:14:38  来源:igfitidea点击:

What's wrong? PHP Parse error: syntax error, unexpected '}', expecting ',' or ';' in

php

提问by aerond

Me and my mate we're trying to solve this for over 1.5 hours, we are still getting the same and tried almost everything we could.

我和我的伙伴我们试图解决这个问题超过 1.5 个小时,我们仍然得到相同的结果并尝试了几乎所有我们能做的事情。

Could anyone help us do that?

有人能帮我们做到这一点吗?

This is error what we're getting:

这是我们得到的错误:

PHP Parse error: syntax error, unexpected '}', expecting ',' or ';' in

And this is the code (line) it's happening on:

这是它发生的代码(行):

if(!isset($_POST['name'])) {echo"Please fill in a valid username"} else {$ok="$ok+1"}

if(!isset($_POST['name'])) {echo"Please fill in a valid username"} else {$ok="$ok+1"}

It's PHP.

是 PHP。

If anyone wants the full code here it is:

如果有人想要这里的完整代码,它是:

$ok=0;
if(isset($_POST['submit'])) {
if(!isset($_POST['name'])) {echo"Please fill in a valid username"} else {$ok="$ok+1"}
if(!isset($_POST['pass'])) {echo"Please fill in a valid password"} else {$ok="$ok+1"}

if($ok==2){
switch($_POST['name'],$_POST['pass']){
    case "FORAEROND","FORAEROND2":


    THIS IS THE TEXT THAT WILL SHOW IF USERNAME IS 'FORAEROND' AND PASSWROD IS 'FORAEROND2'


    break;



    /*case "FORAEROND5","FORAEROND6";        KEEP FOR LATER

    THIS IS THE TEXT THAT WILL SHOW IF USERNAME IS 'FORAEROND5' AND PASSWROD IS 'FORAEROND6'


    break;
    */

    }
  }
}

Thanks to everyone who will help. :)

感谢所有愿意提供帮助的人。:)

EDIT:

编辑:

We apologize to everyone, it was really stupid, somehow we deleted or forgot ';' behind the codes, this is really stupid and awkward.

我们向大家道歉,这真的很愚蠢,不知何故我们删除或忘记了';' 在代码背后,这真的很愚蠢和尴尬。

回答by Ivan Velichko

You missed ;. Each statement must ends up with a semicolon in PHP.

你错过了;。在 PHP 中,每条语句都必须以分号结尾。

回答by shubham715

You missed Semicolumn(;)

你错过了半柱(;)

Replace

代替

if(!isset($_POST['name'])) {echo"Please fill in a valid username"} else {$ok="$ok+1"}

with

if(!isset($_POST['name'])) {echo"Please fill in a valid username"; } else {$ok="$ok+1"; }

回答by Lorence Hernandez

$ok="$ok+1"

you forgot a semicolon here, it should be:

你在这里忘记了分号,它应该是:

$ok="$ok+1";

same goes for the others

其他人也一样