开发者

Get a subdomain of a URL using ColdFusion

How can I get the subdomain of a URL using Coldfusion?

For example, say 开发者_运维知识库I had the following URL:

http://support.foo.com

How could I get 'support'?

Is there a built in function to do this?


Here's the basic idea:

<cfset domain = cgi.server_name>
<cfset subDomain = "">

<cfif ListFirst(domain, ".") neq "foo" and ListFirst(domain, ".") neq "www">
    <cfset subDomain = ListFirst(domain, ".")>
</cfif>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜