編輯py文件,如hello.py
#!/usr/bin/python
import cgi, cgitb
print "Content-type: text/html\n\n"
form = cgi.FieldStorage()
name = form.getvalue('name')
print name
把hello.py放在
/usr/lib/cgi-bin 并賦予可執(zhí)行的權(quán)限 chmod a+x helloworld.py
重啟apache2 /etc/init.d/apache2 restart
在瀏覽器地址欄里輸入:http://localhost/cgi-bin/hello.py
qq
參考地址:http://hi.baidu.com/pc_10/item/d5fe7972fbcc8145ee1e53c3
http://www.tutorialspoint.com/python/python_cgi_programming.htm
posted on 2013-01-06 11:42
漂漂 閱讀(2251)
評(píng)論(0) 編輯 收藏 引用