array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'function.sapi-windows-generate-ctrl-event.php', 1 => 'sapi_windows_generate_ctrl_event', ), 'up' => array ( 0 => 'ref.misc.php', 1 => 'Çeşitli İşlevler', ), 'prev' => array ( 0 => 'function.sapi-windows-cp-set.php', 1 => 'sapi_windows_cp_set', ), 'next' => array ( 0 => 'function.sapi-windows-set-ctrl-handler.php', 1 => 'sapi_windows_set_ctrl_handler', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'tr', 'path' => 'reference/misc/functions/sapi-windows-generate-ctrl-event.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7 >= 7.4.0, PHP 8)
sapi_windows_generate_ctrl_event — Belirtilen sürece bir CTRL olayı gönderir
Aynı süreç grubundaki başka bir sürece belirtilen CTRL olayını gönderir.
olay
Önderilecek CTRL
olayı;
PHP_WINDOWS_EVENT_CTRL_C
veya PHP_WINDOWS_EVENT_CTRL_BREAK
olabilir.
pid
Olayın gönderileceği sürecin kimliği. 0
belirtilirse
olay süreç grubundaki tüm süreçlere gönderilir.
Örnek 1 - sapi_windows_generate_ctrl_event() örneği
Bu örnek, CTRL+BREAK
olaylarının bir alt sürece
nasıl iletileceğini gösterir. Bu durumda, kullanıcı
CTRL+BREAK
tuşlarına basıp süreci sonlandırana
kadar kadar süreç her saniye Hala etkinim
dizgesini
çıktılar.
<?php
// çocuk süreçlere CTRL+BREAK olaylarını ilet
sapi_windows_set_ctrl_handler('sapi_windows_generate_ctrl_event');
// Her saniye bir çıktı verecek bir süreç oluştur
$cmd = ['php', '-r', 'while (true) { echo "Hala etkinim\n"; sleep(1); }'];
$descspec = array(['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']);
$options = ['create_process_group' => true];
$proc = proc_open($cmd, $descspec, $pipes, null, null, $options);
while (true) {
echo fgets($pipes[1]);
}
?>