如果条件不能正常工作[php,drupal]
以下代码应打印“它工作!!”,但它不这样做(它不打印任何内容),可能与编码/解码值或$match数组有关。我不知道我哪里出错了。请帮忙如果条件不能正常工作[php,drupal],php,drupal,drupal-7,imap,Php,Drupal,Drupal 7,Imap,以下代码应打印“它工作!!”,但它不这样做(它不打印任何内容),可能与编码/解码值或$match数组有关。我不知道我哪里出错了。请帮忙 function my_module_init(){ //$hostname,$username, $password are omitted here $inbox = imap_open($hostname, $username, $password); $header = array(); $head = array();
function my_module_init(){
//$hostname,$username, $password are omitted here
$inbox = imap_open($hostname, $username, $password);
$header = array();
$head = array();
$MC = imap_check($inbox);
// Fetch an overview for all messages in INBOX
$result = imap_fetch_overview($inbox,"1:{$MC->Nmsgs}",0);
foreach ($result as $overview){
$hText = imap_fetchbody($inbox, $overview->uid, '0', FT_UID);
$header = explode("\n", imap_fetchheader($inbox, $overview->uid, FT_UID));
foreach($header as $k=>$v){
if(preg_match('/^([^:]*):(.*)/',$v, $match)){
$head[$overview->uid][$match[1]] = $match[2];
}
}
}
//dsm($head[9690401]['X-Call-ID']); //prints "1074148121_43390920@64.158.162.74"
if($head[9690401]['X-Call-ID'] == "1074148121_43390920@64.158.162.74"){
dsm('It works!!');
}
imap_close($inbox);
}
你能试试var_dump($head[9690401]['X-Call-ID'])并分享它给你带来的好处吗?@GratusD。它给出:string(35)“1074148121_43390920@64.158.162.74“可能是您进入了功能,但您的dsm正在被清除,而不是输出。如果你把它换成印刷品,然后去死怎么办@莱格梅森,在这个条件下,一切都不起作用。我试过了it@seb_dom-我是看到开头和结尾有两个空格,还是在这里键入时发生了这种情况?