扩展名为.py或.cgi的CGI脚本

时间:2015-08-29 20:04:35

标签: python cgi

哪一个是首选或正确的做法"从cgi-bin目录在Web主机上运行CGI脚本?两者都是用Python编写的。感谢。

hello.py

#!/usr/bin/python

print "Content-type:text/html\r\n\r\n"
print '<html>'
print '<head>'
print '<title>Hello Word - First CGI Program</title>'
print '</head>'
print '<body>'
print '<h2>Hello Word! This is my first CGI program</h2>'
print '</body>'
print '</html>'

hello.cgi

#!/usr/bin/python

print "Content-type:text/html\r\n\r\n"
print '<html>'
print '<head>'
print '<title>Hello Word - First CGI Program</title>'
print '</head>'
print '<body>'
print '<h2>Hello Word! This is my first CGI program</h2>'
print '</body>'
print '</html>'

0 个答案:

没有答案