【发布时间】:2015-02-04 15:00:37
【问题描述】:
您好……
在我的站点控制器中,我有这段代码可以查询数据库中的表格横幅。
public function actionIndex()
{
$model = new Contacto();
$query = new Query;
$query->select('foto')
->from('banner')
->where('id=1');
$command = $query->createCommand();
$imagem1 = $command->queryOne();
$model = new Contacto();
$query = new Query;
$query->select('foto')
->from('banner')
->where('id=2');
$command = $query->createCommand();
$imagem2 = $command->queryOne();
$model = new Contacto();
$query = new Query;
$query->select('foto')
->from('banner')
->where('id=3');
$command = $query->createCommand();
$imagem3 = $command->queryOne();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(Url::toRoute(['site/sucessocontacto']));
} else {
return $this->render('index', [
'model' => $model, 'imagem1' => $imagem1, 'imagem2' => $imagem2, 'imagem3' => $imagem3
]);
}
}
在我看来,我有这个代码:
<?=
Supersized::widget([
'theme' => Supersized::THEME_SLIDESHOW,
'returnType' => Supersized::RETURN_CONTROL,
'options' => [
'slide_interval' => 2000,
'transition' => 1,
'transition_speed' => 1400,
'slide_links' => 'blank',
'random' => 0,
'slides' => [
['image' => implode('', $imagem1)],
['image' => implode('', $imagem2)],
['image' => implode('', $imagem3)],
]
]
]);
?>
这个网站已经完成,并且在我的本地主机上 100% 运行良好。
我将网站上传到实时服务器,但它总是在视图代码中引发错误。错误是: implode():传递的参数无效
没有出现 var_dump $image1,因为它首先给出了错误。
任何人都知道为什么它像魅力一样工作并在本地主机上工作的横幅中显示所有 3 张图像,但在实时服务器上它总是在 implode() 函数上出现此错误?
服务器中的 PHP 版本设置为 5.5,这是我在 localhost 中开发的版本。
我尝试将 $image1 2 和 3 vars 声明为数组但没有用,var_dump 到 vars 总是显示类似于 array1[0] => bool(false)
在过去的几个小时里,我一直试图解决这个问题,但没有成功。为了测试目的,我必须在一天结束时使用该网站。
非常感谢您的回答。
【问题讨论】:
标签: arrays arguments yii2 implode