我想用逗号分解平台数据,例如:Windows、Mac、Linux。
我尝试了不同的选项,但仍然没有找到解决方案。所以我有一个问题,如何分解我用这段代码得到的数据?
<?php
$this->load->model('catalog/platform');
$query = $this->db->query("SELECT p2p.platform_id, p.parent_id FROM "
. DB_PREFIX . "platform p LEFT JOIN " . DB_PREFIX . "product_to_platform p2p
ON p.platform_id=p2p.platform_id WHERE product_id='" . $product_id . "' AND parent_id=0");
$prodplatforms = $query->rows;
foreach($prodplatforms as $prodplatform){
$platform_id = $prodplatform['platform_id'];
$platform_info = $this->model_catalog_platform->getPlatform($platform_id);
$caturl = (HTTP_SERVER . 'index.php?route=product/platform&path=' . $platform_id);
$str = $platform_info['name'];
echo '<a href="' . $caturl . '">' . $str . '</a>';
}
?>