致命错误:未捕获错误:类';workerThread';(PHP线程)
我不熟悉PHP和Xampp。我在使用pthreads时遇到问题 我得到的错误是:致命错误:未捕获错误:类';workerThread';(PHP线程),php,Php,我不熟悉PHP和Xampp。我在使用pthreads时遇到问题 我得到的错误是: Fatal error: Uncaught Error: Class 'workerThread' not found 我的代码是 class workerThread extends Thread { public function __construct($i){ $this->i=$i; } public function run(){ while(true){ echo $this-
Fatal error: Uncaught Error: Class 'workerThread' not found
我的代码是
class workerThread extends Thread {
public function __construct($i){
$this->i=$i;
}
public function run(){
while(true){
echo $this->i;
sleep(1);
}
}
}
function run() {
global $profilesCount, $profilesNames;
for ($i = 2; $i < $profilesCount+2; $i++) {
$workers[$i]=new workerThread($i);
$workers[$i]->start();
}
}
类workerThread扩展线程{
公共功能构造($i){
$this->i=$i;
}
公共功能运行(){
while(true){
echo$this->i;
睡眠(1);
}
}
}
函数运行(){
全球$profilescont,$profilesNames;
对于($i=2;$i<$profilescont+2;$i++){
$workers[$i]=新workerThread($i);
$workers[$i]->start();
}
}
- PHP版本是
7.0.6
- pthreads版本是
3.1.6
- PHP扩展构建是API20151012,TS,VC14
- 我尝试了32位和64位pthreads版本
- 我将
复制到php\u pthreads.dll
C:\xampp\php\ext\
- 我将
复制到pthreadVC2.dll
,C:\xampp\php\
,C:\xampp\apache\bin
C:\windows\system32
- Apache不是从
中添加的C:\xampp\php\php.ini
开始的,所以我用extension=php\pthreads.dll
将文件复制到extension=php\pthreads.dll
C:\xampp\php\php cli.ini