This question already has answers here:
exec() with timeout
                                
                                    (7个答案)
                                
                        
                                5年前关闭。
            
                    
我有两个带有超时参数的exec()函数。
例如:

<?php
exec("timeout 5 /usr/local/bin/trun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat'",$t_uptime);
exec("timeout 5 /usr/local/bin/wrun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat'",$t_uptime);
?>


没用我想在5秒钟后停止exec(),然后下一个exec()函数开始执行。
请更正此错误或提供其他替代方法来停止exec()功能

最佳答案

exec —执行外部程序

string exec ( string $command [, array &$output [, int &$return_var ]] )

exec() executes the given command.

关于php - exec()与超时参数在PHP? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22533334/

10-16 08:21