0

如何像这样隐藏带有base64的url?

<img src="show_image.php?url=aHR0cDovL2RvbWFpbi5jb20vaW1hZ2UuanBn">
4

1 回答 1

0

在 php 中,您可以使用 base64_encode() 在 base64 中进行编码,并使用 base64_decode() 进行解码。

因此,在您的 html 页面脚本中,您可以执行以下操作:

<?php
$imageUrl = 'the image url';
echo '<img src="show_image.php?url=' . base64_encode($imageUrl) . '">';

当然,您需要在 show_image 脚本上对其进行解码:

<?php
$imageUrl = base64_decode($_GET['url']);
$image = imagecreatefromstring(file_get_contents($imageUrl));
header('Content-Type: image/png');
imagepng($image);
于 2019-11-16T12:14:28.983 回答