嘿伙计们,我在PHP上完全感到困惑's imap functions, they are all over the place and I'已经通过评论来挖掘这一点 . 我可以做 imap_fetchbody($connection, 5, null); 并检索整个消息,它给了我所需要的一切:
即:
收件人:user@gmail.com内容类型:multipart / mixed; boundary = 001517570c8a681a5004a36a1fd6 --001517570c8a681a5004a36a1fd6 Content-Type:multipart / alternative; boundary = 001517570c8a681a4804a36a1fd4 --001517570c8a681a4804a36a1fd4 Content-Type:text / plain; charset = ISO-8859-1 asdf --001517570c8a681a4804a36a1fd4 Content-Type:text / html; charset = ISO-8859-1 asdf --001517570c8a681a4804a36a1fd4---001517570c8a681a5004a36a1fd6 Content-Type:image / gif; name =“ajax-loader.gif”Content-Disposition:attachment; filename =“ajax-loader.gif”Content-Transfer-Encoding:base64 X-Attachment-Id:f_gnruant80 ...此处省略了一堆代码...
但我真的希望数组或对象中的这些信息能够使用它 . without 必须考虑一些正则表达式来从上面的整个文本中获取数据 .
有谁知道这样做的方法或使用哪个php imap命令?还是有一个地方有很好的例子,谁都知道?
1 回答
您可以为
section
参数(第3个参数)使用非空值 . 请参阅http://php.net/manual/en/function.imap-fetchbody.php的第二个示例 . 我想这就是你在寻找的东西 .