审查视图

lib/Lang.php 647 字节
1  
邓超 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
<?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;
    }



}