onlyang 发表于 2016-8-12 16:39:27

下面的site_url后的删除链接不显示循环也断了 怎么回事 table不能用site_url吗

<meta http-equiv="content-type" content="text/html; charset=utf-8">
<html>
<head>
<center><h2>浏览新闻</h2></center>
</head>
<center>
<table border="1">
<tr><?php echo $b['id'];?><th align="center">标题</th><th align="center">内容</th>
<th align="center">时间</th><th>编辑方式</th>
</tr>
<?php

foreach($a as $b){

?>
<tr>
<td align="center"><?php echo $b['title'];?></td>
<td align="center"><?php echo $b['content'];?></td>
<td align="center"><?php echo $b['time'];?></td>
<td ><a href="<?=site_url('/message/del')?>/<?php echo site_url($b)?>">删除</a></td>
</tr>
<?php }?>
</table>
</center>
</html>

Michael锐生 发表于 2016-8-13 09:41:46

后面的site_url的数组下标id没用引号括起来

Aloghli 发表于 2016-8-15 10:35:34

<?=site_url('/message/del')?>/<?php echo site_url($b)?>这个什么写法啊?<?=site_url('/message/del/'.$b['id'])?>这样不行啊再说了   你写法有问题

Hex 发表于 2016-8-15 14:39:47

应该是报错了,所以循环中断了,因为 PHP 已经停止运行了。

timshuns 发表于 2016-8-16 15:19:01

<td ><a href="<?=site_url('/message/del')?>/<?php echo site_url($b)?>">删除</a></td>
改成
<td><a href="<?=site_url('/message/del/'.$b['id'])?>">删除</a></td>

 喜剧之王  发表于 2016-8-18 11:19:45

你把报错开启不就知道啥问题了,为什么要用猜的呢
页: [1]
查看完整版本: 下面的site_url后的删除链接不显示循环也断了 怎么回事 table不能用site_url吗