### CGI控制台相关函数

#### 内容

- CGI/控制台相关函数简介
- CGI/控制台输入输出函数
- CGI变量以及环境相关函数

#### CGI/控制台相关函数简介

CGI/控制台相关函数仅当使用TSL语言编写CGI或者编写控制台应用的时候才被使用。

此处的CGI兼容于TSL在APACHE或者IIS上以MODULE方式运行的模式。

#### CGI/控制台输入输出函数

##### 内容

- Echo
- SetEchoString
- UnsetEchoString
- IsEchoRedirect
- Read
- ReadLn
- Writeln
- Write

##### Echo

##### SetEchoString

ECHO和WRITE,WRITELN等输出函数被重定向，不再输出，用UnSetEchoString获得重定向的输出流。

##### UnsetEchoString

##### IsEchoRedirect

##### Read

范例

范例一：读单个字符，不用回显：Ch:=Read(1,'');

范例二：读一个密码串，以*显示输入的字符：Password:=Read(0,'*');

##### ReadLn

##### Writeln

范例

```tsl
// 先输出111222，接着另起一行显示空白，再接着另起一行输出333
writeln("111", "222");
writeln("333");
{结果页面中，运行信息下打印：
111222
333
}
```

##### Write

范例

```tsl
// 先输出123456，接着另起一行输出789
write("123", "456");
write("789");
return;
{在结果页面中打印：
123456
789}
```

#### CGI变量以及环境相关函数

##### 内容

- HttpGetContent
- HttpGetContentLength
- HttpGetQueryString
- HttpGetRequestMethod
- HttpGetQueryValues
- HttpGetQueryValueByName
- HttpGetQueryValueByNameEx
- HttpGetScriptName
- HttpGetPathInfo
- HttpGetPathTranslated
- HttpGetRemoteHost
- HttpGetRemoteAddr
- HttpGetAuthType
- HttpGetRemoteUser
- HttpGetRemoteIdent
- HttpGetHttpAccept
- HttpGetHttpUserAgent
- HttpGetServerName
- HttpGetServerPort
- HttpGetServerProtocol
- HttpGetServerSoftware
- HttpGetGatewayInterface
- HttpGetCookie
- HttpGetEnvVar
- HttpSetHeadString

##### HttpGetContent

##### HttpGetContentLength

##### HttpGetQueryString

范例

前端执行的是http://hostname/test.tsl?name=billgates&sex=male，

则返回的值为name=billgates&sex=male

##### HttpGetRequestMethod

##### HttpGetQueryValues

##### HttpGetQueryValueByName

##### HttpGetQueryValueByNameEx

##### HttpGetScriptName

##### HttpGetPathInfo

##### HttpGetPathTranslated

##### HttpGetRemoteHost

##### HttpGetRemoteAddr

##### HttpGetAuthType

##### HttpGetRemoteUser

##### HttpGetRemoteIdent

##### HttpGetHttpAccept

##### HttpGetHttpUserAgent

##### HttpGetServerName

##### HttpGetServerPort

##### HttpGetServerProtocol

##### HttpGetServerSoftware

##### HttpGetGatewayInterface

##### HttpGetCookie

##### HttpGetEnvVar

##### HttpSetHeadString
