用python写一个自己的网页

时间:2019-05-01 00:17:23   收藏:0   阅读:177

一、使用python写CGI程序

CGI(Common Gateway Interface)也叫通用网关接口,它是一个web服务器主机提供信息服务的标准接口,只要遵循这个接口,web服务器就能获取客户端提交的信息,转交给服务端的CGI程序进行处理,然后将处理结果返回给客户端。CGI通讯是由两部分组成的:一部分是用户的浏览器显示的页面,也就是html页面,另一部分则是运行在服务器上的CGI程序。

实例如下:

print ("Content-type:text/html")
print ()
print (<html>)
print (<head>)
print (<meta charset="gb2312">)
print (<title>Hello Word - 我的第一个 CGI 程序!</title>)
print (</head>)
print (<body>)
print (<h2>Hello Word! 我是来自菜鸟教程的第一CGI程序</h2>)
print (</body>)
print (</html>)

用浏览器打开网址效果:

技术分享图片

 

原文:https://www.cnblogs.com/sgy614092725/p/shiguiyu13.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!