【发布时间】:2012-09-19 13:19:42
【问题描述】:
我通常在 Application.cfc 的第一行中设置应用程序范围的数据源名称:
<cfscript>THIS.datasource="mydsn";</cfscript>
如果我需要在代码的某些部分更改它怎么办?
具体来说,我的意思是:
- 如果 cgi.server_name 等于 "www.firsturl.com" => this.datasource = "firstdsn"
- 如果 cgi.server_name 等于 "www.secondurl.com" => this.datasource = "seconddsn"
我可以为每个请求都这样做吗?
【问题讨论】:
-
这很容易让您简单地测试一下,看看会发生什么,对吗?只需在 Application.cfc 中为
this.datasource声明添加条件...
标签: coldfusion datasource coldfusion-10 application.cfc