windows phpstudy python cgi配置

修改apache配置文件:httpd.conf

  • 搜索’Define SRVROOT’, 查看cgi根目录,python脚本需要放在该
    Define SRVROOT "D:/Program/phpstudy_pro/Extensions/Apache2.4.39
  • 解决中文乱码
    文件最后添加AddDefaultCharset gbk
    重启apache

python脚本:

#!python
# -*- coding: utf-8 -*-

print ("Content-type:text/html")
print ()                             # 空行,告诉服务器结束头部
print ('<html>')
print ('<head>')
print ('<meta charset="utf-8">')
print ('<title>Hello Word - 我的第一个 CGI 程序!</title>')
print ('</head>')
print ('<body>')
print ('<h2>Hello Word! 我是来自菜鸟教程的第一CGI程序2222</h2>')
print ('</body>')
print ('</html>')
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值