读取 Symfony 项目中的 markdown 文件

发布于 2024-08-31 21:01:19 字数 53 浏览 12 评论 0原文

有没有推荐的方法来使用 Symfony 打开文件?我正在尝试打开 Markdown 源文件。

Is there any recommended way to open a file using Symfony? I'm trying to open a Markdown source file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

缘字诀 2024-09-07 21:01:19

我不认为有特殊的 symfony 方式
只需使用普通的 PHP 文件系统函数即可,例如 file_get_contents

I don't think there is a special symfony way.
Just use the normal PHP filesystem functions for that, e.g. file_get_contents

酒与心事 2024-09-07 21:01:19

sfMarkdownPlugin 自述文件详细介绍了文件内容的 Markdown 处理。在说明中,它使用 symfony 'data' 目录来存储文件,并使用 sfConfig 类来访问文件内容。

$file = sfConfig::get('sf_data_dir').'/content/about.txt';
if (!is_readable($file))
...

您要求使用 symfony 方式来读取文件,它就是。

进一步查看; http://www.symfony-project.org/plugins/sfMarkdownPlugin/ 0_1_1?tab=plugin_readme

The sfMarkdownPlugin README file details the Markdown processing for file contents. In the directions it uses the symfony 'data' directory to store the file, and uses the sfConfig class to access the file contents.

$file = sfConfig::get('sf_data_dir').'/content/about.txt';
if (!is_readable($file))
...

You asked for a symfony way to read a file, there it is.

See further; http://www.symfony-project.org/plugins/sfMarkdownPlugin/0_1_1?tab=plugin_readme

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文