Pages: [41] 40 39 38 37 … 1 » Show All
t.php里面的内容就是: <?php echo time();
请教一个技术问题: function g($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//不要输出,在curl_exec中返回
$ret = curl_exec($ch); $errno = curl_errno($ch); if($errno){ echo ‘Curl error #’.$errno.’: ‘ . curl_error($ch); $ret = ”; } curl_close($ch); return $ret; } 用这段代码请求一个本的URL: for ($i=1; $i<=30000; $i++){ $sec = g('http://192.168.1.8/test/t.php' ; if ($sec == ''){ break; } echo $i.' '; flush(); } 请求到28000多次时,就会报: Curl error #7: Failed to connect to 192.168.1.8: Cannot assign requested address 但http://192.168.1.8/test/t.php肯定没问题,我用浏览器访问,一切正常,用上面的g函数就是不行,但只要等个一分钟左右,就又恢复了可以了
Name
Mail (will not be published)
Website
Notify me of followup comments via e-mail
PHP开发组成员, PECL开发者, 曾供职于雅虎, 现就职百度.
Apache browser bug C++ charset COOKIE core c写PHP扩展 debug encoding engine Extension GET IE javascript js json Module mysql namespace nginx PHP php5.4 PHP5.4新特性 PHP extension php原理 PHP应用 PHP扩展 php源码 php源码分析 SAPI session utf8 variable vim Yaf Zend/PHP 乱码 作用域 原理 开发php扩展 性能 扩展PHP 扩展开发 正则 GNU C/C++ (3) Js/CSS (24) Linux/Unix (15) MySQL/PostgreSQL (7) PHP Extension (13) PHP应用 (138) PHP源码分析 (72) 转载 (30) 随笔 (68)
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
t.php里面的内容就是:
<?php
echo time();
请教一个技术问题:
function g($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//不要输出,在curl_exec中返回
$ret = curl_exec($ch);
;
$errno = curl_errno($ch);
if($errno){
echo ‘Curl error #’.$errno.’: ‘ . curl_error($ch);
$ret = ”;
}
curl_close($ch);
return $ret;
}
用这段代码请求一个本的URL:
for ($i=1; $i<=30000; $i++){
$sec = g('http://192.168.1.8/test/t.php'
if ($sec == ''){
break;
}
echo $i.' ';
flush();
}
请求到28000多次时,就会报:
Curl error #7: Failed to connect to 192.168.1.8: Cannot assign requested address
但http://192.168.1.8/test/t.php肯定没问题,我用浏览器访问,一切正常,用上面的g函数就是不行,但只要等个一分钟左右,就又恢复了可以了