改进Lang类的detect方法 返回当前语言 取消 LANG_SET 常量

This commit is contained in:
thinkphp
2016-06-13 17:05:50 +08:00
parent 126bb348ca
commit 8b0078d936
3 changed files with 22 additions and 4 deletions

View File

@@ -71,6 +71,7 @@ class Request
protected $module;
protected $controller;
protected $action;
protected $langset;
/**
* @var array 请求参数
@@ -968,4 +969,20 @@ class Request
return $this->action ?: '';
}
}
/**
* 设置或者获取当前的语言
* @access public
* @param string $lang 语言名
* @return string
*/
public function langset($lang = null)
{
if (!is_null($lang)) {
$this->langset = $lang;
return $this;
} else {
return $this->langset ?: '';
}
}
}