简体   繁体   中英

CakePHP calling a function from app_controller from child

Im wondering if someone could help me out a little.

I have a controller called room_controller.php in which i have a function that i want to call a function from the app_controller.php but it doesnt seem to be working, my code is as follows;

class RoomController extends AppController {

    function search_people() {
        parent::search_people();
    }

}

Above is my child controller, below is the app_controller.php

class AppController extends Controller

    function search_people() {
        $this->log('I am running now');
    }

}

I'm using a very old version of CakePHP ( 1.3 )

Any help getting this going would be greatly appreciated.

The answer to this, given to me by @Beginner was to add the public keyword to the function in the app_controller

class AppController extends Controller

    public function search_people() {
        $this->log('I am running now');
    }

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM