【发布时间】:2012-02-13 07:25:27
【问题描述】:
<?php
$res=$comments->result_array();
$i=1;
$ar=array();
foreach($res as $row){
$a=array($i,$row['title'],$row['date_post'],
$row['date_edit'],
'<a href="edit_post?title='.$row['title'].'">Edit</a>',
'<a href="delete_post?title='.$row['title'].'">Delete</a>');
array_push($ar,$a);
$i++;
}
echo $this->table->generate($ar);
echo $this->pagination->create_links();
?>
我在我的页面中添加了两个链接(编辑和删除),这篇文章前面是这个href issue in view-controler
上一个帖子的解决方案让我在处理上述源 sn-p 中创建的每个链接的 URL 时更加困惑,例如 http://localhost/blog/get_comments/edit_post?title=something/,而我期望像 http://localhost/blog/edit_post?title=something 这样的东西。我很感激任何帮助。谢谢。
更新
上面的源代码可以正常工作,直到我点击上面代码中创建的编辑或删除链接,这会将 URL 解析为http://localhost/blog/get_comments/edit_post?title=something/,而我期望类似http://localhost/blog/edit_post?title=something。
【问题讨论】:
-
你的问题很不清楚。你能把它改写得更清楚吗?
标签: php html codeigniter url