如何显示图像&Codeigniter中的it's属性


How to display image & it's attribute in Codeigniter

我有HTML代码在我的HTML文件,这是工作

<img class="uk-text-center" 
   data-uk-scrollspy="{cls:'uk-animation-slide-left', delay:600}" 
   alt="download our app" 
   src="assets/images/app.jpg">

我现在使用Codeigniter框架,所以上面的行不能在Codeigniter代码中工作。

所以把上面一行写成

<?php 
    $img_prop=array('src'=>'assets/images/app.jpg',
                     'alt'=>'download our app',
                     'style'=>'display: block; margin-right: auto; margin-left: auto;');
    echo img($img_prop);
?>

上面的代码行运行良好,但是上面的代码缺少一个属性。

data-uk-scrollspy="{cls:'uk-animation-slide-left', delay:600}"

我不能在上面的php代码中添加此属性,请帮助我如何将此属性添加到上面的php代码&

很简单,你可以像这样添加…

$img_prop=array('src'=>'assets/images/app.jpg',
                 'alt'=>'download our app',
                 'data-uk-scrollspy'=>"{cls:'uk-animation-slide-left', delay:600}",
                 'style'=>'display: block; margin-right: auto; margin-left: auto;');
print_r($img_prop);

检查一下,如果有任何问题请告诉我……div ['}