当我在带有
的视图中输出数据库内容时,我在一个名为'website'的数据库中有一个字段site: <?php echo $profile['site']; ?> <br/>
我得到回音
http://facebook.com
但无法点击链接,我还在配置文件中全局禁用了xss过滤。在我的验证中,我只使用了这个
$this->form_validation->set_rules('site', 'Website', 'min_length[5]|max_length[160]');
请帮助
答案 0 :(得分:2)
如果链接格式化为一个链接,则该链接才会变为可点击。你需要在它周围放置适当的html来实现这一点。
site: <a href="<?php echo $profile['site']; ?>">It's a link!</a>
答案 1 :(得分:1)
使用URL帮助器并使用anchor()函数将变量转换为链接。
在控制器中:
$this->load->helper('URL');
在视图中:
<?php echo anchor($profile['site']); ?> <br/>
答案 2 :(得分:0)
以CodeIgniter的方式(使用URL helper),它将如下所示:
echo anchor($profile['site'], 'Profile');