0

我一直在摆弄 PHP,我想知道是否有可能做这样的事情。

如果是这样,您能否提供示例代码?

更新:我的意思是,我想对 URI 中可能存在的任何文件进行编码,而不是 URI 本身。对不起,如果我不清楚。

4

4 回答 4

3

我不明白为什么不...

<?php $file = file_get_contents("http://example.com/myfile.txt");
      $encoded = base64_encode($file);
于 2012-11-24T07:11:28.510 回答
3

你可以放:

base64_encode(file_get_contents('http://www.google.com'));
于 2012-11-24T07:11:53.643 回答
2

file_get_contents函数将获取给定 URL 的 HTML, base64_encode函数将对其进行编码。

<?php 
    $content = file_get_contents("http://google.com");
    $encodedContent = base64_encode($content);
?>
于 2012-11-24T07:15:08.567 回答
1

您想对 URL 进行 base64 编码吗?简单的...

base64_encode($uri)
于 2012-11-24T07:10:33.983 回答