[英]Basic php question
New to php. PHP新手。 Can anyone tell me what this means? 谁能告诉我这是什么意思?
if(!isset($_POST['submit']) || $Email!=$ConfirmEmail || !$info_str || !$valid_email)
IF
There is no element named 'submit' in the _POST array
OR
if $Email is not equal to $ConfirmEmail
OR
$info_str is empty
OR
$valid_email is zero
then do something...mostly split an error to the user.
Effectively it does error checking, ensuring the request has come through a form submit, has a valid email that matches the confirm email and has a non empty $info_str variable value. 有效地,它执行错误检查,确保请求已通过表单提交,具有与确认电子邮件匹配的有效电子邮件,并且具有非空的$ info_str变量值。
It's a bunch of checks to see if certain variables/post fields aren't set, or if the Email and ConfirmEmail variables don't match. 要检查是否未设置某些变量/帖子字段,或者Email和ConfirmEmail变量是否不匹配,需要进行大量检查。
Broken down into pieces: 分解成碎片:
if( < IF
!isset($_POST['submit']) < NOT (IS SET (POST FIELD 'submit'))
|| < OR
$Email!=$ConfirmEmail < VARIABLE 'Email' IS NOT EQUAL TO VARIABLE 'ConfirmEmail'
|| < OR
!$info_str < NOT (VARIABLE 'info_str' IS A TRUE VALUE)
|| < OR
!$valid_email < NOT (VARIABLE 'valid_email' IS A TRUE VALUE)
)
Note that due to the !
注意,由于!
"nots", many of the conditions are actually the opposite of what they would otherwise be (ie positive test if $valid_email
is actually a false value - such as being null
). “ nots”,许多条件实际上与其他条件相反(即,如果$valid_email
实际上是一个假值,例如为null
$valid_email
肯定测试)。
It is form validator. 它是表单验证器。 If form is submitted and email equal predefined email, and other variables are defined. 如果提交表单并且电子邮件等于预定义的电子邮件,则定义其他变量。
if ( // if
!isset($_POST['submit']) // 'submit' element in $_POST array is not set
|| // or
$Email != $ConfirmEmail // $Email does not equal $ConfirmEmail
|| // or
!$info_str // $info_str is false
|| // or
!$valid_email // $valid_email is false
)
!
negates a value. 否定的值。 'foo'
would usually be regarded as true
, the negated !'foo'
is false
. 'foo'
通常被认为是true
,否定的!'foo'
是false
。 ''
(an empty string) is usually regarded as false
, the negated !''
is true
. ''
(空字符串)通常被视为false
,否定的!''
为true
。 See PHP type comparison tables and Logical Operators . 请参阅PHP类型比较表和逻辑运算符 。
我只需要重新排列结构即可解决我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.