For those of you in the WAMP environment, here is a little function that you may find handy:
<?
function kill_proc($processName)
{
@$processList = win32_ps_list_procs();
foreach ($processList as $processArray)
{
$pid = $processArray['pid'];
if (basename($processArray['exe']) == $processName)
{
`taskkill /f /PID $pid 2>&1`;
}
}
}
?>
-CF
win32_ps_list_procs
(PECL win32ps:1.0.1)
win32_ps_list_procs — 稼動中のプロセスの一覧を取得する
説明
array win32_ps_list_procs
( void
)
稼動しているすべてのプロセスについての統計データを取得します。
返り値
失敗した場合、FALSE を返します。 成功した場合、実行中のすべてのプロセスについての統計情報を 含む配列を返します。統計情報の形式は win32_ps_stat_proc() が返すものと同じです。
win32_ps_list_procs
cf at chronofish dot com
10-Sep-2007 11:27
10-Sep-2007 11:27
