public function abc()
{
$action = 'save';
$method = 'POST';
$input = Elm::input('goods_name', '商品名称')->required();
$images = Elm::uploadImage('field', '图片', 'imageload');
//创建表单
$form = Elm::createForm($action)->setMethod($method);
//添加组件
$form->setRule([$input,$images]);
$form->setTitle('标题');
//$script = $form->formScript();
//dd($script);
//生成表单页面
echo $formHtml = $form->view();
}
public function imageload()
{
$file = $this->request->file('file');
$url = \think\facade\Filesystem::disk('public')->putFile('topic', $file);
$url = 'http://tp6.com/storage/'. $url;
$response = Response::uploadSuccess($url, '上传成功');
echo $response->getContent();
}
上面是代码:
url没有回传过去 但是后端返回到前端了
返回的url 粘贴到浏览器可以正常访问到图片的
并且前端还有一个地方报错了 求大神解答