Lang.php 647 字节
<?php

namespace Lib;

/**
 * 语言
 * @author:dc
 * @time 2023/2/13 10:42
 * Class Lang
 * @package Lib
 */
class Lang {

    /**
     * @var Lang
     */
    public static $instance;

    private $message = [];

    public function __construct()
    {
        $this->message = require_once ROOT_PATH."/lang/".APP_LANG.'.php';
    }

    /**
     *
     * @param $key
     * @return mixed
     * @author:dc
     * @time 2023/2/13 10:49
     */
    public static function msg($key){

        if(empty(static::$instance)){
            static::$instance = new Lang();
        }

        return static::$instance->message[$key]??$key;
    }



}