可能重复:
将 PHP 查询的结果拆分为列
我有以下代码行从数据库中提取描述,
我想要做的是添加<br/>到描述中,这样它就不会显示为一长串数据。
mb_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..'
当前的:
数据 数据 数据 数据 数据 数据 数据 数据 数据 数据 数据 数据
必需的:
数据数据
数据数据
数据数据
完整代码:
            $this->data['products'][] = array(
                'product_id'  => $result['product_id'],
                'thumb'       => $image,
                'name'        => $result['name'],
                'description' => mb_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
                'price'       => $price,
                'special'     => $special,
                'tax'         => $tax,
                'rating'      => $result['rating'],
                'reviews'     => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'])
            );