Redirect ('controller_name');
在http模式下工作,但不在cmd模式下工作。
如何在Codeigniter中以CMD模式转发到另一个控制器?
I'm trying to achieve the following.
Controller A forward to Controller B (one of many subclasses of A decided upon what Model A returns in that time) in cron jobs.
答案 0 :(得分:1)
Redirect
只执行header('location: controller_name');
,无法在CLI模式下完成。
如果您正在尝试加载另一个控制器并执行它,您最好尽可能地查看HMVC(http://codeigniter.com/wiki/Modular_Extensions_-_HMVC/)方法:
modules::run('controller_b/action/param');
而不是
redirect('controller_b/action/param');
希望有帮助吗?