位置函数(cflocation 标记)中的 addtoken 参数是布尔值吗?

Is the addtoken parameter in the location function(cflocation tag) a boolean?

我正在使用 CF9。

函数cflocation有一个参数

addToken = "yes|no"

如果这实际上是一个布尔值,则没有提及,例如下面两个是等价的吗?

<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "no">
<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "false">

cfscript中使用函数调用此方法时 Location 我可以传递一个 boolean 作为参数吗?

<cfscript>
   location(url="http://localhost:8500/administrator", addtoken = false);
</cfscript>

是的,它们是相同的,是的,您可以将它们作为参数传递到 cfscript 中。您甚至可以使用 0 和 1。

为假:

<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "no">
<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "false">
<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "0">
<cfscript>location(url="http://localhost:8500/cfdocs/dochome.htm", addtoken = false);</cfscript>
<cfscript>location(url="http://localhost:8500/cfdocs/dochome.htm", addtoken = "no");</cfscript>
<cfscript>location(url="http://localhost:8500/cfdocs/dochome.htm", addtoken = 0);</cfscript>

为真:

<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "yes">
<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "true">
<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "1">
<cfscript>location(url="http://localhost:8500/cfdocs/dochome.htm", addtoken = true);</cfscript>
<cfscript>location(http://localhost:8500/cfdocs/dochome.htm", addtoken = "yes");</cfscript>
<cfscript>location(url="http://localhost:8500/cfdocs/dochome.htm", addtoken = 1);</cfscript>

顺便说一句,您可以通过创建一个小样本文件并对其进行测试来轻松地自行验证这一点。