无法在 codeigniter 中获取动态元标记
我正在使用 codeigniter,我正在尝试使用动态元标记,但元标记对我不起作用,这是我在控制器中的代码
$id = $this->uri->segment(2);
$data['id'] = $id;
$data['metas'] = array(
array('name'=>'description', 'content'=>'A short but sweet DEFAULT description of this fine site'),
array('name' =>'keywords', 'content'=>'some awesome DEFAULT keywords for those rascally web crawlers')
);
这是我的视图
<?php
foreach($metas as $meta)
{?>
<meta name="<?=$meta['name']?>" content="<?=$meta['content']?>" />
<?php }?>
I am working on codeigniter and i am trying to use dynamic meta tag but meta tags not working for me, Here is my code in controller
$id = $this->uri->segment(2);
$data['id'] = $id;
$data['metas'] = array(
array('name'=>'description', 'content'=>'A short but sweet DEFAULT description of this fine site'),
array('name' =>'keywords', 'content'=>'some awesome DEFAULT keywords for those rascally web crawlers')
);
Here is my view
<?php
foreach($metas as $meta)
{?>
<meta name="<?=$meta['name']?>" content="<?=$meta['content']?>" />
<?php }?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需进入 codeigniter 3 system/helpers/html_helper.php 并复制该函数并将其放入您自己的库中
Just go inside codeigniter 3 system/helpers/html_helper.php and copy the function and put it in your own libraries