【发布时间】:2014-07-10 19:20:45
【问题描述】:
我不确定如何调试它,函数imap_msgno() 返回 0 而不是消息号,没有任何错误。这是导致问题的代码部分(带有调试信息):
// Retrieve and order emails
$search = imap_search($this->open, 'SINCE "' . $date . '"');
$sorted_search = $this->order_search($search, $sorted);
// Store all the messages
$Messages = array();
foreach($sorted_search as $msgUID) {
$msgNo = imap_msgno ($this->open, $msgUID);
$header = imap_header($this->open, $msgNo);
var_dump($msgUID);
var_dump($msgNo);
if (empty($header->message_id)) {
var_dump($header);
}
else {
echo "Good";
}
echo " | ";
// mode code ...
}
这应该返回许多int (12) int (10) Good | int (11) int (9) Good | ...。然而,事实并非如此,它返回这个(为清楚起见添加了返回):
int(12) int(10) Good |
int(11) int(9) Good |
int(10) int(0) bool(false) |
int(9) int(0) bool(false) |
int(8) int(8) Good |
...
如您所见,$msgNo 似乎是正确的。 function imap_msgno() in the documentation 没有提供有关无效$msgNo 行为的更多信息,我认为它应该是有效的$msgNo,因为它是返回的imap_search() 的一部分。知道如何调试它或哪里出错了吗?
【问题讨论】:
-
你在混用 UIDS 和消息序列号吗?