3

我正在尝试在 CDetailView 中显示图像,这是我的代码:

<?php
$this->widget('zii.widgets.CDetailView', array(
    'data'=>$model,
    'attributes'=>array(
            'image',
                    array(
                    'name'=>'image',
                    'type'=>'raw',
                    'value'=> CHtml::image(Yii::app()->request->baseUrl.'../../../images/arsip/'.$model->image),
                    ),

            ),
    ));
?> 

页面可以查看,但图像无法显示,我也在尝试,'value'=>html_entity_decode(CHtml::image($model->image,'alt',array('width'=>341,'height'=>232))),但只显示“alt”字符串。

4

1 回答 1

2

First Observer the image path in mozilla firebug.

I hope this is your folder Structure

        App
        |
        |
        ----assets
        |
        |
        ----css
        |
        |
        ----images
        |   |
        |   |
        |   ---------arsip
        |
        ----protected
        |
        |
        ----themes

If this is.. Change the path like below.

       CHtml::image(Yii::app()->baseUrl . '/images/arsip/'..$model->image),
于 2013-07-23T10:26:27.250 回答