php - ( ! ) 解析错误:语法错误,第 121 行 D:\Yatharth Files\wamp\www\index.php 中的意外 '{'
问题描述
为什么这段代码会抛出错误?
<?php
if(isset($_POST['aca'])){
header("location:Academic");
}elseif(isset($_POST['ed'])){
header("location:EnjoyDev");
}elseif(isset($_POST['hb'])){
header("location:Hoverboard");
}elseif(isset($_POST['lc'])){
header("location:LiveChat");
}elseif(isset($_POST['mp']){
header("location:myPro");
}elseif(isset($_POST['ym'])){
header("location:YatMath");
}
?>
第 121 行:}elseif(isset($_POST['mp']){
我没有错过任何分号。
解决方案
第 121 行:
}elseif(isset($_POST['mp']){
应该
} elseif( isset($_POST['mp']) ) {
另外,我建议您使用空格来提高代码的可读性。那时你就不会犯这个错误了。
推荐阅读
- c# - 500 从 .net core 2.1 调用标量数据库函数时出错
- reactjs - 将 FilterText 或 Search 输入实现到 reactjs 应用程序
- r - R人口统计学包消息长度中的read.demogdata
- javascript - 如何让 IFrame 一次重绘所有内容
- dynamics-crm - 用于合并创建线索的插件
- mysql - 使用 MYSQL 提取文本列的一部分
- bash - bash 解析空格分隔的文本文件
- apache - 当存在同名文件时,Htaccess 正在匹配目录
- excel - Vlookup 并求和一个包含逗号分隔值的单元格
- vb.net - 如何使用 DataGridView.AutoGenerateColumns = False 创建我自己的列