感谢 ruchee,Tim Hallman,SMshrimant
https://www.v2ex.com/t/351428
https://stackoverflow.com/questions/19735250/running-a-python-script-from-php
转 php 框架 Php 依赖框架 后台 调用python 脚本
##html 的按钮和其他选项框 起到 中介功能,调用后端。
以下案例仅仅对windows php 调用python 脚本有效
D:\wamp64\www\app 新建2个文件index.php 和 test.py
index.php
//php.php <html> <body> <head> <title> run </title> </head> <form method="post"> <input type="submit" value="GO" name="GO"> </form> </body> </html> <?php if(isset($_POST[‘GO‘])) { exec("D:/python3/python.exe D:/wamp64/www/peng/test.py 2>&1"); echo"success"; } ?>
test.py
#!D:\python3\python.exe # -*- coding: utf-8 -*- import os os.makedirs("thisfolder");
http://localhost/app/index.php
完成后,就会创建一个目录
thisfolder
转 php 框架 Php 依赖框架 后台 调用python 脚本
原文:https://www.cnblogs.com/feiyun8616/p/13213055.html