dongzouya5792
2015-07-15 11:59
浏览 43
已采纳

在OpenCart中正确回显PHP变量中的HTML标记

I am trying to directly output HTML stored within my MySQL database as HTML, but the browser is rendering it as plain text.

I am working within OpenCart so I am not sure if there are references in other pages that may be affecting my code.

This is where I am defining the variable from the MySQL array

$results = $this->model_catalog_manufacturer->getManufacturers();
   foreach ($results as $result) {
      if (is_numeric(utf8_substr($result['name'], 0, 1))) {
            $key = '0 - 9';
        } else {
            $key = utf8_substr(utf8_strtoupper($result['name']), 0, 1);
        }

        if (!isset($data['categories'][$key])) {
            $data['categories'][$key]['name'] = $key;
        }

        $data['categories'][$key]['manufacturer'][] = array(
            'name' => $result['name'],
            'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $result['manufacturer_id']),
            'image' => $result['image'],
            'banner' => $result['banner'],
            'blurb' => $result['blurb'],
        );
    }

$data['brand_blurb'] = $manufacturer_info['blurb'];

This is where I am echoing the variable

<div class="brand_description"><?php echo $brand_blurb; ?></div>

Do you know what I might be doing wrong? I am still new to PHP so I appreciate the help.

Thank you

1条回答 默认 最新

相关推荐 更多相似问题