Error: syntax error, unexpected 'endforeach' (T_ENDFOREACH)
来源:互联网 发布:医院没有编制 知乎 编辑:程序博客网 时间:2024/05/08 02:00
在跟着CakePHP写Blog这个小代码时,访问这个action:‘http://localhost/cakephp/posts/index’,Chrome报错了,错误如下:
Fatal Error
Error: syntax error, unexpected 'endforeach' (T_ENDFOREACH)
File: D:\Program Files\wamp\www\cakephp\app\View\Posts\index.ctp
Line: 48
php code:
<table>
<tr>
<th>Id</th>
<th>Title</th>
<th>Created</th>
</tr>
<!-- Here is where we loop through our $posts array, printing out post info -->
<?php foreach ($posts as $post); ?>
<tr>
<td><?php echo $post['Post']['id']; ?></td>
<td>
<?php echo $this->Html->link($post['Post']['title'], array('controller' => 'posts', 'action' => 'view', $post['Post']['id'])); ?>
</td>
<td><?php echo $post['Post']['created']; ?></td>
</tr>
<?php endforeach; ?>
<?php unset($post); ?>
</table>
网上参考链接:
http://stackoverflow.com/questions/20919202/php-syntax-error-unexpected-endforeach-t-endforeach
- Error: syntax error, unexpected 'endforeach' (T_ENDFOREACH)
- unexpected T_ENDFOREACH PHP FOREACH循环 syntax error, unexpected T_ENDFOREACH错误
- syntax error: unexpected identifier
- syntax error, unexpected $end
- Syntax Error: unexpected token <
- 分析一下:Syntax error: "(" unexpected
- line 1: syntax error: unexpected "("
- Syntax error: "(" unexpected出错原因
- syntax error near unexpected token `
- line 1:syntax error: unexpected "("
- line 1: syntax error: "(" unexpected
- Syntax error: word unexpected (expecting ")")
- line 1: syntax error: "(" unexpected
- line 1: syntax error: "(" unexpected
- syntax error near unexpected token `('
- Syntax error: word unexpected (expecting ")")
- Syntax error: word unexpected (expecting ")")
- line 1: syntax error: unexpected "("
- 程序员学习能力提升三要素
- iOS中如何处理memory warning
- android IPC通信机制中BBinder与BpBinder的区别
- Raw-OS源码分析之系统初始化
- Java中final关键字的使用方法
- Error: syntax error, unexpected 'endforeach' (T_ENDFOREACH)
- 八数码问题(bfs+哈希)
- android增加可以切换开关机动画与铃声
- stopPropagation, preventDefault 和 return false 的区别
- 后缀数组模版 及 可重叠和不可重叠最长重复子串【for_wind】
- Http Live Streaming 实现iphone在线播放视频(1)-参考
- HTTP 报文详解
- Java UDP网络编程(一)-简单示例
- 3.静态链表实现 线性表