使用百度编辑器上传商品详情的时候上传了多张图片,在显示给前台的时候,把html实体做H5适配,直接显示在前端页面。
$goods_content = htmlspecialchars_decode($goods['goods_content']);
$host = $_SERVER['HTTP_HOST'];
$rep = "http://".$host."/public/upload";
$content = str_replace("/public/upload",$rep,$goods_content);
//给img加上样式
$content = str_replace("<img", "<img style=\"width:100%;\" alt=\"\" ", $content);
$content = '<html><head><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0"></head><body style="width: 100%;margin: 0;">'
.$content. '</body></html>';
$goods_info['goods_content'] = $content;
php中的商品contentH5适配
猜你喜欢
转载自blog.csdn.net/sluckyboy/article/details/82630609
今日推荐
周排行