gpt4 book ai didi

image - 无法在 Yii 中显示图像

转载 作者:行者123 更新时间:2023-12-01 09:34:23 25 4
gpt4 key购买 nike

我正在尝试在 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' 字符串。

最佳答案

首先观察mozilla firebug中的图片路径

我希望这是你的文件夹结构

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

如果这是.. 像下面这样改变路径。

       CHtml::image(Yii::app()->baseUrl . '/images/arsip/'..$model->image),

关于image - 无法在 Yii 中显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17803330/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com