您可以在IMAP库中使用IMAP_SEARCH中的条件吗? [英] Can you use conditionals in IMAP_SEARCH from the PHP IMAP library?
问题描述
在探索代码并搜索文档时,我还没有找到任何东西。有没有人能够实现这一点?
I haven't been able to find anything while exploring the code and searching for documentation. Has anyone been able to achieve this?
http:// php.net/manual/en/function.imap-search.php
推荐答案
不,你不能。 (很难相信,对吗?)
No, you can't. (Hard to believe, right?)
PHP使用Mark Crispin的c-client库进行IMAP工作。在c客户端库中,在 mail.c
中将一个不推荐的方法 mail_criteria
将IMAP搜索字符串转换为一个c客户端搜索程序。 mail_criteria
已经在过去8年左右被弃用,因此,从未更新以支持IMAP4搜索语法。所以IMAP2中不存在的搜索字词如 OR
在 mail_criteria
函数中没有得到支持。这里是所有支持的条款,起始于' O
':
PHP uses Mark Crispin's c-client library under the hood to do its IMAP work. In the c-client library, there is a deprecated method mail_criteria
in mail.c
that translates an IMAP search string to a c-client search program. mail_criteria
has been deprecated for the past 8 years or so and, as such, was never updated to support the IMAP4 search syntax. So search terms like OR
that weren't present in IMAP2 never got support in the mail_criteria
function. Here's all the terms it supports starting with an 'O
':
case 'O': /* possible OLD, ON */
if (!strcmp (criterion+1,"LD")) f = pgm->old = T;
else if (!strcmp (criterion+1,"N"))
f = mail_criteria_date (&pgm->on,&r);
break;
OR
不在该列表中。因此,即使c客户端在其 SEARCHPGM
结构体中支持 OR
,它也不解析或
在已弃用的 mail_criteria
函数中。
OR
isn't on that list. So even though the c-client supports OR
in its SEARCHPGM
structs, it doesn't parse OR
in the deprecated mail_criteria
function.
而 PHP仍然使用 mail_criteria
来解析搜索查询 。因此,直到c客户端库不会废弃 mail_criteria
并使其符合IMAP4或PHP编写自己的IMAP搜索解析器时,您将被卡住,支持任何IMAP2 。 哪些不包括 OR
。
And PHP still uses mail_criteria
to parse search queries. In 2011. So until either the c-client library un-deprecates mail_criteria
and makes it IMAP4-compliant or PHP writes its own IMAP search parser, you are stuck with whatever IMAP2 supported. Which doesn't include OR
.
这篇关于您可以在IMAP库中使用IMAP_SEARCH中的条件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!