PHP解析错误:语法错误,意外'&&' (T_BOOLEAN_AND),错误位于何处? [英] PHP Parse error: syntax error, unexpected '&&' (T_BOOLEAN_AND), where is error located?

查看:57
本文介绍了PHP解析错误:语法错误,意外'&&' (T_BOOLEAN_AND),错误位于何处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <?php  
if(isset($ _ POST [ ' inputName3'])&& isset($ _ POST [' inputEmail3'])&& isset($ _ POST [' inputSite3 '])&& isset($ _ POST [' inputMessage3']))
{
$ inputName3 = $ _POST [' inputName3' ];
$ inputEmail3 = $ _POST [' inputEmail3 ];
$ inputSite3 = $ _POST [' inputSite3 ];
$ inputMessage3 = $ _POST [' inputMessage3 ];

if(!empty($ inputName3)&&!empty($ inputEmail3)&&!empty($ inputSite3)&&!empty($ inputMessage3))
{
if(strlen($ inputName3)> 25 || strlen($ inputEmail3)> 50 || strlen($ inputSite3)> 30 || strlen($ inputMessage3)> 1000){
echo ' 抱歉,某些字段的maxlength已经过超过;
} else {
$ to = ' ahammad559@gmail.com';
$ subject = ' 这是一封电子邮件;
$ body = $ inputName3。 \\ \\ n \ n。$ inputMessage3;
$ headers = ' 来自:php学院< ahammad559@gmail.com>';
if(@mail($ to,$ subject,$ body,$ headers)){
echo ' 感谢您与我们联系。我们很快就会接触到。;
} else {
echo ' 抱歉,发生错误。请再试一次';
}
}
}
else {
echo ' 所有字段都是必需的';
}
}
?>

解决方案

_POST [' inputName3'])&& isset(


_POST [' inputEmail3'])& &安培; isset(


_POST [' inputSite3'])& &安培; isset(

<?php
if(isset($_POST['inputName3']) && isset($_POST['inputEmail3']) && isset($_POST['inputSite3']) && isset($_POST['inputMessage3']))
{
$inputName3 = $_POST['inputName3'];
$inputEmail3 = $_POST['inputEmail3'];
$inputSite3 = $_POST['inputSite3'];
$inputMessage3 = $_POST['inputMessage3'];

if(!empty($inputName3) && !empty($inputEmail3) &&!empty($inputSite3) &&!empty($inputMessage3) )
{
if(strlen($inputName3)>25 || strlen($inputEmail3)>50 || strlen($inputSite3)>30 || strlen($inputMessage3)>1000){
  echo 'Sorry, maxlength for some field has been exceeded';
 }else{
  $to = 'ahammad559@gmail.com';
 $subject = 'This is an email';
 $body = $inputName3."\n\n".$inputMessage3 ;
 $headers = 'From : "php academy" <ahammad559@gmail.com>';
 if(@mail($to, $subject, $body, $headers)){
 echo 'Thanks for contacting us.we\'ll be touch in soon.';
 }else{
 echo 'Sorry, an error occurred.Please try again';
 }
 }
}
else{
 echo'all fields are required';
}
}
?>

解决方案

_POST['inputName3']) && isset(


_POST['inputEmail3']) && isset(


_POST['inputSite3']) && isset(


这篇关于PHP解析错误:语法错误,意外'&amp;&amp;' (T_BOOLEAN_AND),错误位于何处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆