我在 Controller 中有一个看起来像这样的函数
void function edit(required struct rc) output="false" {
...
if (...) {
ArrayAppend(rc.message, "<b>Error:</b> Something did not work right.");
variables.fw.redirect(".home", "all");
return; // ?
}
}
我需要返回
还是重定向意味着返回?
最佳答案
如果您查看 FW/1 源代码中的重定向方法,您会发现它只是执行常规 cflocation。这意味着,页面执行不会越过该行代码,因此不需要返回。
https://github.com/framework-one/fw1/blob/develop/framework/one.cfc#L1031
代码片段
...
location( targetURL, false, statusCode );
...
关于coldfusion - 在 FW/1 上,我需要在重定向后返回吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27028293/