【问题标题】:Can you use conditionals in IMAP_SEARCH from the PHP IMAP library?您可以在 PHP IMAP 库中的 IMAP_SEARCH 中使用条件吗?
【发布时间】:2011-03-10 18:28:42
【问题描述】:

在探索代码和搜索文档时,我找不到任何东西。有没有人能够做到这一点?

http://php.net/manual/en/function.imap-search.php

【问题讨论】:

    标签: php email imap


    【解决方案1】:

    不,你不能。 (难以置信,对吧?)

    PHP 在底层使用 Mark Crispin 的 c-client 库来完成其 IMAP 工作。在 c-client 库中,mail.c 中有一个已弃用的方法 mail_criteria,它将 IMAP 搜索字符串转换为 c-client 搜索程序。 mail_criteriahas been deprecated for the past 8 years or so and, as such, was never updated to support the IMAP4 search syntax。因此,像 OR 这样在 IMAP2 中不存在的搜索词永远不会在 mail_criteria 函数中得到支持。以下是它支持的所有以“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

    还有PHP still uses mail_criteria to parse search queries。在 2011 年。因此,在 c-client 库取消弃用 mail_criteria 并使其符合 IMAP4 或 PHP 编写自己的 IMAP 搜索解析器之前,您将无法使用任何 IMAP2 支持。 Which doesn't include OR.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-20
      • 1970-01-01
      • 1970-01-01
      • 2020-06-10
      • 1970-01-01
      相关资源
      最近更新 更多