因為在<img>標簽中引用微信的圖片
<?php $img = "http://mmbiz.qpic.cn/mmbiz /ibbmVK4uC7iacR4KGWnyJHvQxl276DK6eGibiafBFTLObjBtKU9hGZoiaaiaD49r4u9otkQzCGAPAbWlPVzrpyCRaCVA/0"; ?>
<img src="<?php echo $img;?>"/>
會顯示如圖所示:
這是因為微信現在也開始防外鏈導致,在經過一天的搜索努力以后發現了如下方法可以解決,利用js解決。
解決方法如下:
<script type="text/javascript"> function showImg(url) { var frameid = 'frameimg' + Math.random(); console.debug(frameid); console.debug(url); window.img = '<img id="img" style="width:50%" src=\'' + url + '?' + Math.random() + '\' /><script>window.onload = function() { parent.document.getElementById(\'' + frameid + '\').height = document.getElementById(\'img\').height+\'px\'; }<' + '/script>'; document.write('<iframe id="' + frameid + '" src="javascript:parent.img;" frameBorder="0" scrolling="no" width="50%"></iframe>'); } </script> <h1>原圖:</h1> <br> <img src="http://mmbiz.qpic.cn/mmbiz/dYNplyiblCFna8JoYZw71MH8Z8ib8KBALnJ7DibpDVSLPW4oy0nVhPfEG7PxCVwia6YP1OFibowWWkm2T0pn63icArPQ/0?tp=webp&wxfrom=5&wx_lazy=2" /><br> <h1>js破解之后:</h1> <br> <div id="hotlinking"> <script type="text/javascript">showImg('http://mmbiz.qpic.cn/mmbiz/ibbmVK4uC7iacR4KGWnyJHvQxl276DK6eGlZQ10E7BeY7Fw0ZlnPLXOSF8W4qIiaCsNspcEiaicD0McR79qmicfPGntg/0');</script> </div>

