dpi96151 2017-10-24 00:44
浏览 39
已采纳

CakePHP 3从插件Webroot提供文件

I am under the impression that any files placed in the webroot/ folder of a plugin in CakePHP 3 should be served automagically. However, I have not been able to get a file to be served from that folder...

I have created an example project

https://github.com/CakePHPKitchen/CakePHP-Plugin-Webroot-Issue

In the example project, I have baked a plugin named Elite and inside the plugins/Elite/src/webroot I have placed a text file named bingo.txt

To reproduce the issue

My Question is, how do I retrieve bingo.txt?

Do I have to set a setting somewhere to enable that webroot folder?

  • 写回答

1条回答 默认 最新

  • doulan8054 2017-10-24 01:07
    关注

    Make sure the plugin is loaded in your config/bootstrap.php

    Plugin::load('Elite');
    

    Then link to the webroot of the plugin with localhost:8675/elite/bingo.txt

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?