user706087
user706087

Reputation: 359

Codeigniter redirect (or forward to another controller equivalent) in CMD mode

Redirect ('controller_name'); 

works in http mode but NOT in cmd mode.

How can I forward to another controller in CMD mode in Codeigniter?

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.

Upvotes: 0

Views: 2148

Answers (1)

Gavin
Gavin

Reputation: 6394

Redirect simply does a header('location: controller_name'); which can't be done in CLI mode.

If you are trying to load another controller and execute it, you are best off looking at the HMVC (http://codeigniter.com/wiki/Modular_Extensions_-_HMVC/) method as you can do:

modules::run('controller_b/action/param');

instead of

redirect('controller_b/action/param');

Hope that helps?

Upvotes: 1

Related Questions