遇到PHP错误
严重性:注意
消息:数组到字符串转换
文件名:views / editslideshows.php
行号:56
回溯:
文件:C:\ Program Files \ EasyPHP-Devserver-16.1 \ eds-www \ companygiondaci \ application \ views \ editslideshows.php 行:56 功能:_error_handler
文件:C:\ Program Files \ EasyPHP-Devserver-16.1 \ eds-www \ companygiondaci \ application \ controllers \ Cpages.php 行:310 功能:查看
文件:C:\ Program Files \ EasyPHP-Devserver-16.1 \ eds-www \ companygiondaci \ index.php 行:315 功能:require_once
视图/ editslideshows.php
<?php foreach ($images as $images_item): ?>
<?php echo $images; ?>
<?php endforeach; ?>
控制器/ Cpages.php
public function editslideshow() {
$image_id = $this->uri->segment(3);
$data['images'] = $this->Mpages->call_point_slideshow($image_id);
$this->load->view('editslideshows', $data);
}
模型/ Mpages.php
public function call_point_slideshow($image_id)
{
$this->db->where('image_id', $image_id);
$query = $this->db->get('slideshow');
return $query->result();
}
答案 0 :(得分:2)
在您的视图页面views/editslideshows.php
您直接使用echo <?php echo $images; ?>
,这就是您收到错误的原因。
您可以使用$images_item->db_field_name
。这意味着slideshow
表
低于我的纠正:
<?php foreach ($images as $images_item): ?>
<?php echo $images_item->db_field_name; ?>
<?php endforeach; ?>
答案 1 :(得分:1)
在你看来
<?php foreach ($images as $images_item) { ?>
<h3><?php echo $images_item->field_name; ?></h3>
<?php } ?>