public function code()
{
$wordId = input('wordId');
if (!$wordId) {
$this->error('数据异常');
}
$word = Db::name('word');
$word_data = $word->where('word_id', $wordId)->find();
$path = ROOT_PATH . 'Public/' . $word_data['code_path'];
if ($word_data['code_path'] && file_exists($path)) {
$img = $word_data['code_path'];
} else {
$rr = request()->domain();
$rr = $rr . url('student/home/code', ['wordId' => $wordId]);
$name = $word_data['grade_id'] . '_' . $word_data['word_name'];
$img = $this->qrcode($rr, $name);
$word->where('word_id', $wordId)->update(['code_path' => $img]);
}
$this->assign('img', $img);
return $this->fetch();
}
public function qrc
PHP生成二维码
最新推荐文章于 2024-03-12 11:41:09 发布