yii2 add custom global function

  Add the following code to composer.json

 

    "autoload": {
        "files": [
            "common/components/GlobalFunctions.php"
        ]
    }

 

then execute

composer update

exist

common/components/GlobalFunctions.php

Just write the function you want in the file

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326480497&siteId=291194637