Laravel - 公用文件夹

时间:2018-06-11 02:08:40

标签: php laravel image laravel-5 path

我正在使用tinymce编辑器将图像上传到我的服务器,而我在设置路径时遇到问题。在位于 postAcceptor.php /public中,它会将图片上传到 {{1}内的 /articles/assets/images/ 文件夹中} 即可。

/public中,我使用 web.php 来显示已在服务器中上传的图片。但是,图像指示错误的来源,因此无法显示图像。它的来源应该是: -

Route::get('/articles/{id}', function(){...})

但实际上,它表明: -

localhost:8000/articles/assets/images/fragment%20life%20cycle.png

localhost:8000/articles **/articles**/assets/images/fragment%20life%20cycle.png

postAcceptor.php

有没有办法解决这个问题,或者是否有任何关于absoulte或相对路径的线索?

/public folder

Upload success

/articles/44 - displaying image page

image src

1 个答案:

答案 0 :(得分:0)

Laravel内置了路径助手,您可以使用它来确保始终找到正确的路径到达您想要的地方。

尝试更改

./aws-cpp-sdk-ec2-integration-tests
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from EC2OperationTest
[ RUN      ] EC2OperationTest.DescribeSpotFleet
../aws-cpp-sdk-ec2-integration-tests/EC2Tests.cpp:133: Failure
Value of: outcome.IsSuccess()
   Actual: false
   Expected: true
[  FAILED  ] EC2OperationTest.DescribeSpotFleet (36636 ms)
[ RUN      ] EC2OperationTest.CreateSecurityGroup
../aws-cpp-sdk-ec2-integration-tests/EC2Tests.cpp:145: Failure
Value of: createOutcome.IsSuccess()
   Actual: false
   Expected: true
[  FAILED  ] EC2OperationTest.CreateSecurityGroup (36639 ms)
[----------] 2 tests from EC2OperationTest (73276 ms total)
[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (146552 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 2 tests, listed below:
[  FAILED  ] EC2OperationTest.DescribeSpotFleet
[  FAILED  ] EC2OperationTest.CreateSecurityGroup

2 FAILED TESTS

$imageFolder = "articles/assets/images/";