微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

go-fastcgi

程序名称:go-fastcgi

授权协议: BSD

操作系统: 跨平台

开发语言: Google Go

go-fastcgi 介绍

go-fastcgi 是为 Go 语言实现的 fastcgi 应用库,简单易学。

示例代码

package main

import (  
        "fmt"  
        "fastcgi"  
        "os"  
)

type Application struct {  
}

func (a *Application) Handle(r *fastcgi.Request) bool {  
        fmt.Fprintf(r.Stdout, "Content-type: text/html\r\n\r\n")  
        fmt.Fprintf(r.Stdout, "Hello World!\n")  
        fmt.Fprintf(r.Stdout, "stdin: (")  
        for {  
                s, e := r.Stdin.ReadString('\n')  
                if e != nil {  
                        break  
                }  
                fmt.Fprintf(r.Stdout, "%s", s)  
        }  
        return true  
}

func main() {  
        a := new(Application)  
        err := fastcgi.RunStandalone(":12345", a)  
        if err != nil {  
                fmt.Fprintf(os.Stderr, "err in main: %s", err.String())  
                os.Exit(1)  
        }  
}

go-fastcgi 官网

http://code.google.com/p/go-fastcgi/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐