使用exec()总是加载PHP

时间:2014-05-23 08:57:14

标签: php

Bot可以运行,但我的问题是页面总是加载..

如果我从游戏中关闭僵尸程序

,页面将完成加载
function StartGhost($bot) {
    $ini = new INI('ghost.ini');
    $pid = $ini->data["$bot"]['pid'];
    $start_time = $ini->data["$bot"]['start_time'];

    if($pid !== false && $pid != 0) {
        return "Error: the bot is already online.";
    }


    $command = "cd /home/bot/" . $bot . "/ && nohup ./ghost++ > /dev/null 2>&1 & echo $!";
    $pid2 = exec($command);

    $ini->data["$bot"]['pid'] = $pid2;
    $ini->data["$bot"]['start_time'] = time();
    $ini->data["$bot"]['last_time'] = $start_time;
    $ini->write();

    return true;
}


if(isset($_GET['start']) && !isset($_GET['restart']) && !isset($_GET['stop'])) {
    echo StartGhost("bot-viva");    
}

触发码:

<a href="?start=bot-viva"><button>START</button></a>

感谢

0 个答案:

没有答案