0

I'm writing a private function in cakephp like this but I see this error: Using $this when not in object context i think its because I havent access to model and find data from private function help me please

{

public function blah(){
    ...

}
public function call_remember_me(){
    $remembered = remember_me($user_id);

}

}

function remember_me($user_id)
{
    $user = $this->User->findById($user_id);
....


}
  • 1
    That's not a private function, it's a global function, ie it's outside of an object context. Your question doesn't really contain a CakePHP specific problem, as you do not elaborate on the context (what/why/where/...), as it stands, it's more about PHP basics. – ndm May 29 '16 at 12:55
  • Possible duplicate of [Fatal error: Using $this when not in object context in](http://stackoverflow.com/questions/15735099/fatal-error-using-this-when-not-in-object-context-in) – AD7six May 29 '16 at 13:37

0 Answers0