>我在控制器中有一个看起来像这样的函数
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; // ?
}
}
我需要return
还是重定向意味着返回?
如果您查看 FW/1 源中的重定向方法,您会发现它只是执行常规的 cflocation。 这意味着,页面执行不会超过该行代码,因此返回应该是不必要的。
https://github.com/framework-one/fw1/blob/develop/framework/one.cfc#L1031
代码片段
...
location( targetURL, false, statusCode );
...