获取解析错误:语法错误,意外的 '}',期待 ',' 或 '; [英] Getting a Parse error: syntax error, unexpected '}', expecting ',' or ';

查看:47
本文介绍了获取解析错误:语法错误,意外的 '}',期待 ',' 或 ';的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码.我是 php 新手,只是尝试使用 Kompozer 编辑页面.当我将站点发布回 ftp 服务器时,此错误突然出现在页面上.奇怪,因为我什至没有碰过这个代码.(我已经接触了下面的代码试图修复它).任何修复此代码的帮助将不胜感激.

 <div class="error_msg_cont"><?phpforeach($_SESSION["pkg_error"] 作为 $error){回声$错误.
"}?></div><?phpif(isset($_SESSION["msg"])){echo '

'.$_SESSION["msg"] .'

'}?>

解决方案

你错过了 ; on :

echo $error.
"}

echo '

'.$_SESSION["msg"] .'

'}

实际上,错误是不言自明的.

Here is my code. I'm new to php and just trying to edit a page using Kompozer. When I published the site back to the ftp server this error suddenly appeared on the page. Odd since I didn't even touch this code. (I have since touched the below code trying to fix it). Any help fixing this code would be much appreciated.

   <?php 
     if(isset($_SESSION["pkg_error"]))
   ?>
      <div class="error_msg_cont">
    <?php 
    foreach($_SESSION["pkg_error"] as $error)
    {
    echo $error. "<br>"
    }
    ?></div>
    <?php 
    if(isset($_SESSION["msg"]))
    {
    echo '<div class="error_msg_cont">'. $_SESSION["msg"] .'<div>'
    }
    ?>

解决方案

you missed ; on :

echo $error. "<br>" }

and

echo '<div class="error_msg_cont">'. $_SESSION["msg"] .'<div>' }

Actually, the error is self-explained.

这篇关于获取解析错误:语法错误,意外的 '}',期待 ',' 或 ';的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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