如何从PHP网页在不同的服务器上运行Python脚本? [重复]

问题描述 投票:0回答:1

这个问题在这里已有答案:

我有一个托管服务器,托管我的PHP网站,我有另一台服务器(Windows Server),它有Python应用程序。当用户点击我网站上的按钮时,我需要从我的PHP网站启动一个Python应用程序。我还需要获取返回数据并将其显示在网站上。我怎样才能做到这一点?

php python
1个回答
0
投票

来自Running a Python script from PHP

<?php 

$command = escapeshellcmd('/usr/custom/test.py');
$output = shell_exec($command);
echo $output;

?>
© www.soinside.com 2019 - 2024. All rights reserved.