Does the model have to be instantiated when using the model in the TP5 controller?

for example, there is a getuid () method in the User model. For example, do I have to instantiate the User model first when I want to use the method in the controller? $user=new User () and then call this $user- > getuid () method?

Mar.11,2021

you can use the helper function Model ('User')-> getuid ();


can be set to a static method

public static function getuid()
{
...
}

then call

statically
$uid = User::getuid();

non-static methods must of course be instantiated first


within the current model $uid = self- > getuid ();

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b9e95c-2e775.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b9e95c-2e775.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?