请问View::fetch总报错怎么回事呀??

浏览:1359 发布日期:2019/12/24 分类:ThinkPHP6专区
if($this->request->isPost()){
if(request()->param('verify_code')==''){
$this->error("请输入验证码!");
}
if(!captcha_check(request()->param('verify_code'))){
$this->error("验证码错误!");
}
}else{
return View::fetch('index');
}

请问为什么这么写总报错啊
Argument 1 passed to think\View::fetch() must be of the type string, array given, called in G:\Test\jxcn\vendor\topthink\framework\src\think\response\View.php on line 90

/**
* 解析和获取模板内容 用于输出
* @access public
* @param string $template 模板文件名或者内容
* @param array $vars 模板变量
* @return string
* @throws \Exception
*/
public function fetch(string $template = '', array $vars = []): string
{
return $this->getContent(function () use ($vars, $template) {
$this->engine()->fetch($template, array_merge($this->data, $vars));
});
}

/**
* 渲染内容输出
* @access public
最佳答案
评论( 相关
后面还有条评论,点击查看>>