ファイルの内容を取得してbase64を使用してエンコードするスクリプトがあります。このスクリプトは正常に動作します。PHPのデコードbase64ファイルの内容
<?php
$targetPath="D:/timekeeping/logs/94-20160908.dat";
$data = base64_encode(file_get_contents($targetPath));
$file = fopen($targetPath, 'w');
fwrite($file, $data);
fclose($file);
echo "file contents has been encoded";
?>
ここで、コンテンツを元の値に戻したいと思います。私は試しました:
<?php
$targetPath="D:/timekeeping/logs/94-20160908.dat";
$data = base64_decode(file_get_contents($targetPath));
$file = fopen($targetPath, 'w');
fwrite($file, $data);
fclose($file);
echo "file contents has been decoded";
?>
しかし、動作しません。
どちらも同じページにあります。 – Noman
何が問題なのですか?入力と出力の例を示し、実際に得られたものと期待したものとの違いを説明してください。 –
いいえ、同じスクリプトにはありません。 – Joey