How to call another controller function in a controller in cakephp

Hello reader’s In this tutorial we will discuss about “How to call another controller function in a controller in cakephp”.

For doing this, first of all import controller function in your controller that function you want to call.

Once you import the controller, crate an object of that controller than call the function through the created object(which have pointed the imported controller).

Here is a demo.

  1. /*Author: Jaydeep Dhoundiyal* /
  2. <?php
  3. //Import controller
  4. App::import(‘Controller’, ‘Users’);
  5. class ReportsController extends AppController {

Read full Blog about How to call another controller function in a controller in cakephp visit Findnerd.

You can also read such more blogs about CakePHP, Javascript, Android at Findnerd.

You can read more about Findnerd here>> Findnerd-A Social Network for Developers