修正Controller类

This commit is contained in:
thinkphp
2016-06-12 11:21:38 +08:00
parent 069673ea3f
commit b5fa195ad6
2 changed files with 21 additions and 21 deletions

View File

@@ -94,61 +94,61 @@ class Controller
/**
* 加载模板输出
* @access public
* @access protected
* @param string $template 模板文件名
* @param array $vars 模板输出变量
* @param array $replace 模板替换
* @param array $config 模板参数
* @return mixed
*/
public function fetch($template = '', $vars = [], $replace = [], $config = [])
protected function fetch($template = '', $vars = [], $replace = [], $config = [])
{
return $this->view->fetch($template, $vars, $replace, $config);
}
/**
* 渲染内容输出
* @access public
* @access protected
* @param string $content 模板内容
* @param array $vars 模板输出变量
* @param array $config 模板参数
* @return mixed
*/
public function display($content = '', $vars = [], $config = [])
protected function display($content = '', $vars = [], $config = [])
{
return $this->view->display($content, $vars, $config);
}
/**
* 模板变量赋值
* @access public
* @access protected
* @param mixed $name 要显示的模板变量
* @param mixed $value 变量的值
* @return void
*/
public function assign($name, $value = '')
protected function assign($name, $value = '')
{
$this->view->assign($name, $value);
}
/**
* 初始化模板引擎
* @access public
* @access protected
* @param array|string $engine 引擎参数
* @return void
*/
public function engine($engine)
protected function engine($engine)
{
$this->view->engine($engine);
}
/**
* 设置验证失败后是否抛出异常
* @access public
* @access protected
* @param bool $fail 是否抛出异常
* @return $this
*/
public function failException($fail = true)
protected function failException($fail = true)
{
$this->failException = $fail;
return $this;
@@ -156,14 +156,14 @@ class Controller
/**
* 验证数据
* @access public
* @access protected
* @param array $data 数据
* @param string|array $validate 验证器名或者验证规则数组
* @param array $message 提示信息
* @param mixed $callback 回调方法(闭包)
* @return true|string|array
*/
public function validate($data, $validate, $message = [], $callback = null)
protected function validate($data, $validate, $message = [], $callback = null)
{
if (is_array($validate)) {
$v = Loader::validate();

View File

@@ -25,14 +25,14 @@ trait Jump
{
/**
* 操作成功跳转的快捷方法
* @access public
* @access protected
* @param mixed $msg 提示信息
* @param string $url 跳转的URL地址
* @param mixed $data 返回的数据
* @param integer $wait 跳转等待时间
* @return array
*/
public function success($msg = '', $url = null, $data = '', $wait = 3)
protected function success($msg = '', $url = null, $data = '', $wait = 3)
{
$code = 1;
if (is_numeric($msg)) {
@@ -57,14 +57,14 @@ trait Jump
/**
* 操作错误跳转的快捷方法
* @access public
* @access protected
* @param mixed $msg 提示信息
* @param string $url 跳转的URL地址
* @param mixed $data 返回的数据
* @param integer $wait 跳转等待时间
* @return void
*/
public function error($msg = '', $url = null, $data = '', $wait = 3)
protected function error($msg = '', $url = null, $data = '', $wait = 3)
{
$code = 0;
if (is_numeric($msg)) {
@@ -90,14 +90,14 @@ trait Jump
/**
* 返回封装后的API数据到客户端
* @access public
* @access protected
* @param mixed $data 要返回的数据
* @param integer $code 返回的code
* @param mixed $msg 提示信息
* @param string $type 返回数据格式
* @return mixed
*/
public function result($data, $code = 0, $msg = '', $type = '')
protected function result($data, $code = 0, $msg = '', $type = '')
{
return Response::create([], $type)->result($data, $code, $msg);
}
@@ -110,7 +110,7 @@ trait Jump
* @param integer $code http code
* @return void
*/
public function redirect($url, $params = [], $code = 302)
protected function redirect($url, $params = [], $code = 302)
{
$response = new Redirect($url);
if (is_integer($params)) {
@@ -123,10 +123,10 @@ trait Jump
/**
* 获取当前的response 输出类型
* @access public
* @access protected
* @return string
*/
public function getResponseType()
protected function getResponseType()
{
$isAjax = Request::instance()->isAjax();
return $isAjax ? Config::get('default_ajax_return') : Config::get('default_return_type');