【发布时间】:2016-03-20 13:15:33
【问题描述】:
我一直在尝试像 PHP IMAP 扩展一样获取主机信息(主机名、端口、前缀...),但我无法弄清楚。示例字符串:
$host = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX'
我越接近 PHPMailer 所做的(代码取自源代码):
$hostinfo = array();
if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
die(' Not a valid host entry');
}
// $hostinfo[2]: optional ssl or tls prefix
// $hostinfo[3]: the hostname
// $hostinfo[4]: optional port number
// The host string prefix can temporarily override the current setting for SMTPSecure
// If it's not specified, the default value is used
但我无法到达那里。
任何帮助将不胜感激。
【问题讨论】:
-
你有更多示例字符串(带前缀)吗?
-
这是一个故事,你有什么问题?