求教 fsockopen 并发。
我想发邮件 不知道 fsockopen 这个怎么并发邮件
------解决方案--------------------
你可以ajax循环执行发送邮件,也可以用下面两个方法(西面代码是大致思路):
php codeif (isset($_get['act']) && $_get['act'] == 'sendmail') { sendemail();// 发送邮件操作}function fsockget($url, $timeout = 3){ $info = parse_url($url); extract($info); $query = isset($query) ? trim($query) : ''; $path = isset($path) ? trim($path) : ''; $fp = fsockopen($host, 80, $errno, $errstr, $timeout); if (!$fp) { exit($errstr ($errno)
\n); } $write = fwrite($fp, get {$path}?{$query} http/1.0\r\nhost: {$host}\r\n\r\n);// while (!feof($fp)) {// echo fread($fp, 4096);// }}$url = http://mydir.com/index.php?act=sendmail;$emaillist = array(...);foreach ($emaillist as $email) { fsockget($url);}