application.cfc 页面出现 cfml 错误

发布于 2024-08-28 18:36:11 字数 964 浏览 5 评论 0原文

我的 cfml 网站有一些问题。

我在 application.cfc 文件中使用了以下代码来连接 dsn。

但是当我将其放入我的服务器时,我会收到错误。我什至无法浏览一个 test.cfm 页面。

该代码中是否有任何错误,任何语法错误或类似的错误,dsn 是否有问题,

<cfset this.name = "0307de6.netsolhost.com">
<cfset this.sessionmanagement = true>
<cfset this.loginstorage="session">
<cfset this.sessiontimeout = CreateTimeSpan(0,0,30,0)>
<cfset this.applicationtimeout = CreateTimeSpan(2,0,0,0)>

<cffunction name="onApplicationStart">

    <cfscript>
        application.DSN             = "hirerodsn";
        application.dbUserName      = "myusr";
        application.dbPassword      = "myd69!";
    </cfscript>

</cffunction>

<cffunction name="onRequestStart">

    <cfscript>
        request.DSN = "hirerodsn";
        request.dbUserName = "myusr";
        request.dbPassword = "myd69!";
    </cfscript>

</cffunction>

请任何人帮助我

I have some problem with my cfml website.

I have used the below code in application.cfc file to connect with the dsn.

But when ever i put this in my server, i'm getting error. i cant browse even a single test.cfm page.

Is there any mistake in that code , any syntax error or something like that, will it be some problem with the dsn

<cfset this.name = "0307de6.netsolhost.com">
<cfset this.sessionmanagement = true>
<cfset this.loginstorage="session">
<cfset this.sessiontimeout = CreateTimeSpan(0,0,30,0)>
<cfset this.applicationtimeout = CreateTimeSpan(2,0,0,0)>

<cffunction name="onApplicationStart">

    <cfscript>
        application.DSN             = "hirerodsn";
        application.dbUserName      = "myusr";
        application.dbPassword      = "myd69!";
    </cfscript>

</cffunction>

<cffunction name="onRequestStart">

    <cfscript>
        request.DSN = "hirerodsn";
        request.dbUserName = "myusr";
        request.dbPassword = "myd69!";
    </cfscript>

</cffunction>

please anyone help me

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少女净妖师 2024-09-04 18:36:11

请注意,您还应该在问题中至少发布错误消息。

无论如何,这里的错误是您必须将整个 .cfc 文件内容包含在 cfcomponent 标记中:

<cfcomponent output="false">
...
</cfcomponent>

另请注意,您可以在数据源配置中设置用户名和密码,因此您实际上不需要在您的代码(查询)中处理它们。

Please note that you should also post at least error messages in your questions.

Any way, your error here is that you have to enclose whole .cfc file contents inside cfcomponent tag:

<cfcomponent output="false">
...
</cfcomponent>

Also please note that you can set the username and password in datasource configuration, so you don't really need to handle them in your code (queries).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文