前端API返回问题返回
php
public function getCourse(){
try {
$model = app()->make(Classify::class);
$coursewareModel = app()->make(Courseware::class);
$lists = $model->where('pid','=',0)->order(['weigh' => 'desc','id' => 'desc'])
->select()
->toArray();
$baseUrl = $this->request->domain();
foreach($lists as &$val){
$val['image'] = $baseUrl.$val['image'];
$courseware = $coursewareModel
->where('classify_id','in',getSubordinateIds($val['id']))
->limit(4)
->select()
->toArray();
foreach ($courseware as $item){
$item['image'] = $baseUrl.$val['image'];
}
$val['courseware'] = $courseware;
}
var_dump($lists);
$this->success('获取成功',$lists);
}catch (\Exception | \Throwable $exception){
$this->error($exception->getMessage().'==='.$exception->getLine().'==='.$exception->getFile());
}
}
在这段代码中,var_dump(ists);可以正常打印出来,移除var_dump以后 this->success
报错:===114===F:\wwwroot\huang\doc-pay\app\common\controller\Api.php
也没有具体的错误信息,有哪位大佬知道这个是什么情况吗?
请先登录
热门问题
this->success('获取成功',lists); 本身就是抛出错误的方式来进行结束操作.你在try里面.不就把抛出操作拦截了吗?
- 1
前往