note 25259 added to function.base64-encode
| From: | emaman at upandup dot net | Date: | Tue, 17 Sep 2002 10:43:12 +0000 |
| Subject: | note 25259 added to function.base64-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-36810@lists.php.net to get a copy of this message | ||
Here is a workaround for the base64_encode function under Win32.
1) Download the base64.exe program from http://www.fourmilab.ch/.
2) Write your own base64 encode function :
function mybase64_encode($s) {
$tmpfname = tempnam("", "tmp");
$fp = fopen($tmpfname, "w+");
if ( $fp ) {
fwrite ($fp, $s);
fclose($fp);
exec("c:/bin/base64 -e " . $tmpfname . " " . $tmpfname .
".b64");
$fp = fopen($tmpfname . ".b64", "r");
$contents = fread($fp,filesize($tmpfname . ".b64"));
fclose($fp);
unlink($tmpfname);
unlink($tmpfname . ".b64");
return($contents);
}
}
With this function you don't need to call the chunk_split function.
--
http://www.php.net/manual/en/function.base64-encode.php
http://master.php.net/manage/user-notes.php?action=edit+25259
http://master.php.net/manage/user-notes.php?action=delete+25259
http://master.php.net/manage/user-notes.php?action=reject+25259