T
T
Talgat Baltasov2015-07-02 23:17:58
Yii
Talgat Baltasov, 2015-07-02 23:17:58

How to call a function in Yii2 through shell_exec?

There are several functions in the BotController controller. For example, actionFollow(), actionLike(), etc.
I want to call the actionFollow() function through shell_exec() in the actionStart() function. How can I make it so that only the function is called, and not the whole file?
Is this correct?
for ($i=0; $i<20; $i++){
shell_exec("php BotController.php actionFollow > {$i}.out&");
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yakov Akulov, 2015-07-07
@jakulov

A regular controller in Yii works in an HTTP request environment, so running it through the console is categorically wrong.
To run code from the console, there is a separate component in the framework:
https://github.com/yiisoft/yii2/blob/master/docs/g...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question