-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
实时速度等信息无法显示 #31
Comments
根据Demo无法重现问题,检查$toolkit对象是否有问题。 |
感谢题主及明回复。 我用running_info.php测试也可以正常。但我想要的是在下载时可以及时显示,于是我将demo/download.php中,$curl->onInfo = null; 换成了$curl->onInfo = array( 经测试,不加上面的,而是将//$curl->onInfo = null; 注释掉,则可以显示。为什么会有这个不同? SPD:0KB DWN:0MB FNH:0 CACHE:0 RUN:1 ACTIVE:1 POOL:49 QUEUE:0 TASK:50 FAIL:0 SPD:0KB DWN:0MB FNH:0 CACHE:0 RUN:1 ACTIVE:1 POOL:49 QUEUE:0 TASK:50 FAIL:0 SPD:200KB DWN:1MB FNH:7 CACHE:0 RUN:1 ACTIVE:1 POOL:42 QUEUE:0 TASK:50 FAIL:0 SPD:323KB DWN:2MB FNH:15 CACHE:0 RUN:1 ACTIVE:1 POOL:34 QUEUE:0 TASK:50 FAIL:0 SPD:407KB DWN:3MB FNH:23 CACHE:0 RUN:1 ACTIVE:1 POOL:26 QUEUE:0 TASK:50 FAIL:0 SPD:531KB DWN:4MB FNH:32 CACHE:0 RUN:1 ACTIVE:1 POOL:17 QUEUE:0 TASK:50 FAIL:0 SPD:614KB DWN:5MB FNH:41 CACHE:0 RUN:1 ACTIVE:1 POOL:8 QUEUE:0 TASK:50 FAIL:0 SPD:746KB DWN:6MB FNH:50 CACHE:0 RUN:0 ACTIVE:0 POOL:0 QUEUE:0 TASK:50 FAIL:0 |
array(
$toolkit,
'onInfo'
); $toolkit必须是Tookkit对象的实例,回调函数的具体用法看PHP手册:http://php.net/manual/en/function.call-user-func-array.php 下载速度的计算规则是每隔一段时间根据已完成任务下载数据量和时间计算一次,所以要等有任务下载完毕。 |
感谢及时而有用的解答。终于明白了问题所在。 |
设置
$curl->onInfo = array(
$toolkit,
'onInfo'
);
后报错。
开始下载...
E_WARNING: ErrorException: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in D:\WWW\1spider\mcurl\vendor\ares333\php-curl\src\Curl.php:415 Stack trace: #0 [internal function]: ErrorHandler::{closure}(2, 'call_user_func(...', 'D:\WWW\1spider\...', 415, Array) #1 D:\WWW\1spider\mcurl\vendor\ares333\php-curl\src\Curl.php(415): call_user_func(Array, Array, Object(Ares333\Curl\Curl)) #2 D:\WWW\1spider\mcurl\vendor\ares333\php-curl\src\Curl.php(288): Ares333\Curl\Curl->onInfo() #3 D:\WWW\1spider\shokdown.php(46): Ares333\Curl\Curl->start() #4 {main}
程序能正常执行,但会不停报上面的错误。信息也不能显示。
The text was updated successfully, but these errors were encountered: