Home  >  Article  >  Backend Development  >  PHP批量删除提示unexpected 'foreach' (T_FOREACH)是什么原因?

PHP批量删除提示unexpected 'foreach' (T_FOREACH)是什么原因?

PHPz
PHPzOriginal
2016-06-06 20:15:053394browse

PHP批量删除提示unexpected 'foreach' (T_FOREACH)是什么原因?

使用PHP编写批量删除功能,代码运行报错,提示unexpected 'foreach' (T_FOREACH)

a2c85f41920f089ff306740fe4e82daf

错误提示为:

Parse error:  syntax error, unexpected 'foreach' (T_FOREACH) in I:\php-moive\search_delall.php on line 7

百度“ unexpected 'foreach' (T_FOREACH)”几乎找不到相关答案。。

后来发现是因为语法出现错误:

if(is_array($id) && !empty($id)){   <--  这个大括号打成全角了

Parse error:  syntax error, unexpected xxx 一般是报错的内容前面有语法错误。

语法错误特点

1、程序还没开始运行。

2、程序报的是Parse error错误。

推荐教程:PHP视频教程

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn