我一直在摆弄 PHP,我想知道是否有可能做这样的事情。
如果是这样,您能否提供示例代码?
更新:我的意思是,我想对 URI 中可能存在的任何文件进行编码,而不是 URI 本身。对不起,如果我不清楚。
我不明白为什么不...
<?php $file = file_get_contents("http://example.com/myfile.txt");
$encoded = base64_encode($file);
你可以放:
base64_encode(file_get_contents('http://www.google.com'));
file_get_contents函数将获取给定 URL 的 HTML, base64_encode函数将对其进行编码。
<?php
$content = file_get_contents("http://google.com");
$encodedContent = base64_encode($content);
?>
您想对 URL 进行 base64 编码吗?简单的...
base64_encode($uri)