简体   繁体   English

如何在线运行python脚本

[英]How to run a python script online

I want to send some data from php to that python script run the script and return the result to php. 我想将一些数据从php发送到该python脚本,然后运行该脚本并将结果返回给php。 How would I do that? 我该怎么做? how can I even run python online without a framework or a python server. 我什至没有框架或python服务器就可以在线运行python。

Try using exec PHP function: http://php.net/manual/es/function.exec.php 尝试使用exec PHP函数: http : //php.net/manual/es/function.exec.php

Also, if you use Apache web server you'll have to ensure that the "Safe mode" of yout server is deactivated. 另外,如果您使用Apache Web服务器,则必须确保您的服务器的“安全模式”已停用。

It depends on whether you can install Python on your server or not. 这取决于您是否可以在服务器上安装Python。 If yes, call it using the exec function as mvillaress suggested (also see this thread ). 如果是,请按照mvillaress建议使用exec函数调用它(另请参见此线程 )。 If you don't have Python installed and can't install it, then there's not much you can do. 如果您没有安装Python并且无法安装它,那么您将无能为力。 There are online interpreters like Ideone , but I think that calling them programmatically might be considered abuse. 有像Ideone这样的在线口译 ,但我认为以编程方式调用它们可能会被视为滥用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM