Я хочу использовать pthreads, но запуск следующего скрипта просто печатает «1» каждую секунду, он должен отображать «123» каждую секунду, он запускает только первый поток.
<?php
require "/root/vendor/autoload.php";
set_time_limit( 0 );
function print_time( $id ) {
while( true ) {
print( $id );
sleep( 1 );
}
}
class Threaded_upload extends Thread {
public function __construct( $args ) {
$this->args = $args;
}
public function run() {
print_time( $this->args );
}
}
$thread_1 = new Threaded_upload( "1" );
$thread_1->start();
$thread_2 = new Threaded_upload( "2" );
$thread_2->start();
$thread_3 = new Threaded_upload( "3" );
$thread_3->start();
спасибоЗа любую помощь заранее!