当前位置: 首页 > 工具软件 > go-fastcgi > 使用案例 >

golang fastcgi php,Go(golang) FastCGI Client

雍阳
2023-12-01

func main() {

reqParams := "name=value"

env := make(map[string]string)

env["REQUEST_METHOD"] = "GET"

env["SCRIPT_FILENAME"] = "/Users/ivan/work/test/fcgi/test.php"

env["SERVER_SOFTWARE"] = "go / fcgiclient "

env["REMOTE_ADDR"] = "127.0.0.1"

env["SERVER_PROTOCOL"] = "HTTP/1.1"

env["QUERY_STRING"] = reqParams

fcgi, err := fcgiclient.New("127.0.0.1", 9000)

if err != nil {

fmt.Printf("err: %v", err)

}

content, err := fcgi.Request(env, reqParams)

if err != nil {

fmt.Printf("err: %v", err)

}

fmt.Printf("content: %s", content)

}

 类似资料: