【发布时间】:2012-07-11 04:47:12
【问题描述】:
我有以下从数据库中提取描述的代码行,
我要做的是在描述中添加<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'])
);
【问题讨论】: