Php Codeigniter发送GET参数与站点\u url?
我的视图文件中有这部分代码:Php Codeigniter发送GET参数与站点\u url?,php,codeigniter,codeigniter-3,Php,Codeigniter,Codeigniter 3,我的视图文件中有这部分代码: <?php foreach ($posts as $post) { ?> <tr> <td><?php echo $post['id']; ?></td> <td><?php echo $post['title']; ?></td> <td><?php echo $post['content'];
<?php foreach ($posts as $post) { ?>
<tr>
<td><?php echo $post['id']; ?></td>
<td><?php echo $post['title']; ?></td>
<td><?php echo $post['content']; ?></td>
<td>
<div class="btn-group">
<a href="<?php echo site_url('admin/blog/show'); ?>" class="btn btn-success">Edit</a>
<a href="#" class="btn btn-danger">Delete</a>
</div>
</td>
</tr>
<?php } ?>
在哪里发送$post['id']
我在SO中看到一些问题,但答案是硬代码…这里我们有一个例子
echo anchor('news/local/'. $post['id'], 'any text', array('title' => 'The best news!'));
在你的控制器中,你会得到类似的东西
echo $this->uri->segment('3');
还可以加载url帮助程序/库。这里我们有一个示例
echo anchor('news/local/'. $post['id'], 'any text', array('title' => 'The best news!'));
在你的控制器中,你会得到类似的东西
echo $this->uri->segment('3');
还可以加载url帮助程序/库。应该是这样的:
<a href="<?=site_url('admin/blog/show/'.$post['id']); ?>" class="btn btn-success">Edit</a>
更多信息:应该是这样的:
<a href="<?=site_url('admin/blog/show/'.$post['id']); ?>" class="btn btn-success">Edit</a>
更多信息:谢谢你,你帮助我了解更多关于锚函数和uri->segment的信息!谢谢你,你帮助我了解更多关于锚函数和uri->segment的信息!