sgy614092725

一、使用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>\')

用浏览器打开网址效果:

 

分类:

技术点:

相关文章:

  • 2021-11-07
  • 2021-08-09
  • 2021-10-30
  • 2021-11-02
  • 2021-12-02
  • 2022-01-06
  • 2021-12-03
  • 2021-12-07
猜你喜欢
  • 2021-12-07
  • 2021-12-07
  • 2021-10-26
相关资源
相似解决方案