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>
精彩评论