![]() |
Does the error "should not be called statically" mean my namespace or use is wrong? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Does the error "should not be called statically" mean my namespace or use is wrong? (/showthread.php?tid=81089) |
Does the error "should not be called statically" mean my namespace or use is wrong? - castle - 01-23-2022 Hi, I'm confused here. How do I call a method into a controller from another Controller? PHP Code: <?php Code: use App\Controllers\Backend\Authentication\Staff; Code: Staff::method_name(); Code: Non-static method App\Controllers\Backend\Authentication\Staff::login() should not be called statically Thanks RE: Does the error "should not be called statically" mean my namespace or use is wrong? - kenjis - 01-23-2022 > Does the error "should not be called statically" mean my namespace or use is wrong? No. You need to know the difference between static calls and non static calls. https://www.php.net/manual/en/language.oop5.basic.php RE: Does the error "should not be called statically" mean my namespace or use is wrong? - manager - 01-23-2022 Quote:What am I missing? You are calling non-static method like static. Can you show your Staff class? RE: Does the error "should not be called statically" mean my namespace or use is wrong? - datamweb - 04-07-2022 Look here if you use Laravel : Facades |