php调用python

tophp.py

#!/bin/env python
# -*- coding:utf-8 -*-
# Filename:
# Revision: 
# Date:        205-03-04
# Author:      simonzhang
# web:         www.simonzhang.net
# Email:       simon-zzm@163.com
### END INIT INFO
import sys

def test(ar):
    return "your key:%s" % ar

if __name__ == '__main__':
    ar = sys.argv[1]
    if ar:
       get_content = test(ar)
       print get_content

test_getpython.php

然后浏览器里面输入 http://localhost/test_getpython.php?key=test
浏览器会返回your key:test

学习页面:http://blog.163.com/darwin_zhang/blog/static/128488736201111842115199/

发表评论

电子邮件地址不会被公开。 必填项已用*标注