我试着做一个票务系统,但有几种方法。
管道
管道的问题是试图解析附件并将它们保存到文件夹中。
这是我做的一个小剧本
#!/usr/bin/php -q
<?php
//The concern here is having enough mem for emails with attachments.
ini_set('memory_limit', '256M');
ini_set("display_errors", "1");
error_reporting(E_ALL);
$data = isset($_SERVER['HTTP_HOST'])?file_get_contents('php://input'):file_get_contents('php://stdin');
$fdw = fopen("mail.txt", "w+");
fwrite($fdw, $data);
fclose($fdw);
?>用cPanel`s的管道编程。
它生成一个原始的电子邮件字符串,其中包含了很多我不明白的东西。例如:
--_1f366895-b327-4f84-8985-e3826cdf604b_ Content-Type: application/octet-stream Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="something.zip" UEsFBBQACAAIAJuy1DgAAAAAAAAAAAAAAAAKAAAAcmVwb3J0LnhtbNVdW5fbNpJ+n1/B9Z6zb8Mh rgTPJplGt9N2HNvxiTPjM/vGltjdinUbUrLT+fVLUqJEUKSAYoE0p+10YkIdfwCBQl2+qvru73+s lt6XJM0Dm/X3z4gfPPOyXbyex8vNOvn+2VOSPfv7D3/5y3dpst2kux++28V3y+SH72ab5X61zqr/ 8NbxKv/0PN4Dz3747m+Hh43BWbzaxouHdecH4vlDutlvO8c/J09fN+m8e/zryyTb/SNddn5isdpm
是否有方法解析它们(img、docs、zip等)或将它们放在文件夹/什么东西中?
还有别的方法吗?
对外服务?
已经有什么服务在做这个了吗?
发布于 2012-03-28 13:11:25
首先在文件名之后获得输出,然后用base64解码内容,因为正如您在标题:Content-Transfer-Encoding: base64中看到的那样
file_put_contents('something.zip', base64_decode($output));https://stackoverflow.com/questions/9908205
复制相似问题