我对Lumen很陌生。
我有路径public/profile/pic.png
我想为这张图片生成网址并将该网址保存到数据库中。
我尝试了功能url(public/profile/pic.png)
。它的创建http://public/profile/pic.png
.不是正确的网址。
我试过asset(public/profile/pic.png)
错误 - Call to undefined function asset
.我尝试添加 UrlGenerator 类。但它说找不到类。
我在这里被震撼了。请谁能帮我。
编辑:对我来说,甚至 url() 也无法正常工作。它没有创建正确的网址。 http://public/profile/pic.png
.未添加域名。而且 - 我尝试添加 UrlGenerator 类。但它说找不到类。
我发现,在 Lumen 上测试时,没有使用服务器域名。这就是url()不起作用的原因。