Yii2 calls interface across controllers?

how can yii2 be called across controller calling interfaces, and parameters can be passed in.

Mar.05,2021

I usually use curl


Yii2.0 can be called across controllers using the runaction method.

$result = \Yii::$app->runAction(['user/login']);

1. Try to seal the method as static as possible, so that the controller of other words directly :: calls
2, and you can use trait to solve the problem of methods called across controllers. The method to be called is placed in trait


.

here I choose curl, to share with you the curl method

clipboard.png
in this way, there may be more code. If you use cross-controller calls, or jump methods, you should be able to do it with one line of code.

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-1be7e3f-318d4.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-1be7e3f-318d4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?