Answer the question
In order to leave comments, you need to log in
How to write a full path to functions in Yii2?
I prescribe a function and when I want to apply it by prescribing its path like this \\app\controllers\debug(Yii::$app);
I get an error: Call to undefined function app\controllers\debug()
Answer the question
In order to leave comments, you need to log in
If you haven't rewritten the autoload algorithm, then you can't call the function this way. So you can only call a class method. And the call should then be something like:
$controller = new \\app\controllers\DebugController();
$controller->debug(Yii::$app);
namespace app\helpers;
class SystemHelper
{
public static function debug($app)
{
//Код функции
}
}
\app\helpers\SystemHelper::debug(Yii::$app);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question