[英]Run multiple Python scripts simultaneously from PHP
I know if I want to run multiple Python scripts simultaneously I can knock up a bash file that looks like this;我知道如果我想同时运行多个 Python 脚本,我可以敲出一个看起来像这样的 bash 文件;
#!/bin/bash
python pr1.py &
python pr2.py &
python now.py &
python loader.py &
But what if I want to do the same thing directly from PHP?但是如果我想直接从 PHP 做同样的事情呢? It seems clunky to call a bash script from PHP which then runs the Python scripts.从 PHP 调用 bash 脚本然后运行 Python 脚本似乎很笨拙。
好吧,就此而言,从 PHP 调用 Python 脚本似乎很笨拙,但您可以尝试使用shell_exec()
函数或执行运算符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.