Yii-Bootstrap Carousel无法显示图像

时间:2014-02-24 08:16:55

标签: php yii

我无法显示我在应用程序中输入的图像: enter image description here

这是我的代码:/protected/views/site/index.php

<?php
/* @var $this SiteController */

$this->pageTitle=Yii::app()->name;
?>

<h1>Welcome to <i><?php echo CHtml::encode(Yii::app()->name); ?></i></h1>

<p>Congratulations! You have successfully created your Yii application.</p>

<p>For more details on how to further develop this application, please read
the <a href="http://www.yiiframework.com/doc/">documentation</a>.
Feel free to ask in the <a href="http://www.yiiframework.com/forum/">forum</a>,
should you have any questions.</p>

<?php $this->widget('bootstrap.widgets.TbCarousel', array(
'items'=>array(
    array(
    'image'=>'/../images/1.jpg',
    'label'=>'First Thumbnail label',
    'caption'=>'ooo'),
    array(
    'image'=>'/../images/2.jpg',
    'label'=>'Second Thumbnail label',
    'caption'=>'weee'),
    array(
    'image'=>'/../images/3.jpg',
    'label'=>'Third Thumbnail label',
    'caption'=>'pooops'),
  ),
)); ?>

我已将图像文件放在正确的目录中。对我有什么建议吗?感谢

2 个答案:

答案 0 :(得分:0)

<?php $this->widget('bootstrap.widgets.TbCarousel', array(
'items' => array(
 array(
        'image' => 'images/one.jpg',
        'label' => '',
        'caption' => ''),
    array(
        'image' => 'images/two.jpg',
        'label' => '',
        'caption' => ''),
    array(
        'image' => 'images/three.jpg',
        'label' => '',
        'caption' => ''),
),

)); ?&GT;

确保将图像放在www / wamp / project / images

答案 1 :(得分:0)

你可以尝试:

array('image' => Yii::app()->request->baseUrl.'/images/photo.jpg', 'label' => 'projektet', 'caption' => 'teksti'),