如何在Play Framework 2.2.1中读取文件? [英] How to read a file in Play Framework 2.2.1?

查看:90
本文介绍了如何在Play Framework 2.2.1中读取文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个静态文件,要在我的Play框架模型之一中读取.该文件中包含一些简单的文本.我找不到任何示例或API,这些示例或API不能显示存储此类资源的适当位置,其次是如何访问该资源.无论使用什么功能,我都在使用Play for Scala,但我认为这并不重要.

I have a static file that I want to read in one of my Play Framework models. The file contains some simple text in it. I can't find any examples or API that shows where the appropriate location is to store such a resource and second, how to access that resource. For whatever it is worth I'm using Play for Scala, but I don't think that's relevant here.

推荐答案

您可以按照以下说明将任何资源文件放在/conf文件夹中并(以编程方式)加载:

You can place any resource file in the folder /conf and load it (Programatically) as explained here: Custom configuration files - Play! Framework 2.0

这篇关于如何在Play Framework 2.2.1中读取文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆