php - Laravel 在根文件夹外显示图像
问题描述
我在本地机器上运行一个 Laravel 网站。我的 laravel 在文件夹中:/Username/bigproject/laravel-project
在我的 Laravel 应用程序的视图中,有一些标签应该显示 /Username/bigproject/images 文件夹中的文件(所以它在 laravel 根文件夹之外)。如何在 src 中形成 url 以便显示这些图像?
<img src="/Username/bigproject/images/image1.jpg">
不工作,当然。
我玩过https://laravel.com/docs/5.4/filesystem的磁盘存储,但没有结果。
PS。该项目实际上仅供本地使用。
解决方案
As the web server cant access files out side of its root, you can create a symbolic link so the files can be in two locations at once.
ln -s /Username/bigproject/images /Username/bigproject/larave-project/public
thus allowing the web-server (ultimately the browser) to use the access the files with <img src="/catPic.jpg">
推荐阅读
- vba - 访问:如何在单个语句中检查多个字段的条件
- c++ - 如何解决:没有规则来制作目标`/home/xxxxx/opencv-3.4.5/build/lib/libopencv_stitching.so.3.4.5',需要`xxxxx'。停止
- android - 使用 Volley 在 POST 请求中发送参数
- phpunit - BrowserKit 组件不可用
- git - GitLab SSH 推送失败内存 malloc 失败错误
- java - Spring Boot Actuator metric heap.used 随着每个后续执行器 /metrics api 调用而增加
- function - rbind 数据帧作为构建函数的输出
- c++ - 初始化列表的模板替换错误
- msmq - 消息从消息队列中消失
- java - 将参数传递给线程池执行程序