Codeigniter在CMD模式下重定向(或转发到另一个控制器等效)

时间:2012-05-30 13:30:50

标签: codeigniter redirect cron

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.

1 个答案:

答案 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');

希望有帮助吗?