【发布时间】:2014-05-11 10:12:09
【问题描述】:
我有一个问题...我想通过回显显示 tag_name 和 id: 我的数组:
Array
(
[id] => 15
[title] => This is the first article
[content] =>
This is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first articleThis is the first article
[date] => 2014-05-11 12:05:00
[views] => 0
[smallimage] => Hydrangeas-11.jpg
[largeimage] => Hydrangeas-11.jpg
[tags] => first tag,last tag,second tag
[id_tag] => 15,16,17
)
我试过了,但是当我链接时,我进入浏览器:localhost/blogCI/tag/15,16,17 但我需要显示 localhost/blogCI/tag/15 或 localhost/blogCI/tag/16 我的代码:
<div class="news-content-title">
<? echo $main_info['title'];?>
</div>
<div class="news-content-content">
<? echo $main_info['content'];?>
</div>
<?php foreach($main_info as $n):?>
<?php $tags = explode(",", $n['tags']); ?>
<?php $id_tag = explode(",", $n['id_tag']); ?>
<?php endforeach ?>
<?php for ($i=0;$i<count($id_tag);$i++): ?>
<a href="<?php echo base_url('tag/'.$main_info['id_tag'])?>"><?php echo $main_info['tags'] ?></a>
<?php endfor; ?>
请帮帮我
【问题讨论】:
标签: php codeigniter codeigniter-2 php-5.3