我想尝试将图像转换为二进制.
我在网上找到了一个脚本,但它不起作用.
有人可以建议为什么?
<?php
$image="image003.jpg";
$data = fopen ($image, 'rb');
$size=filesize ($image);
$contents= fread ($fd, $size);
fclose ($fd);
$encoded= base64_encode($contents);
echo $encoded;
 ?>
我在第8和第9行出现错误
Warning: fread() expects parameter 1 to be resource
和
Warning: fclose() expects parameter 1 to be resource,
用$data而不是$fd
$data = fopen ($image, 'rb');
$size=filesize ($image);
$contents= fread ($data, $size);
fclose ($data);
| 归档时间: | 
 | 
| 查看次数: | 7933 次 | 
| 最近记录: |