首页 \ 问答 \ 如何链接到Silex中的PDF文件?(How do I link to a PDF file in Silex?)

如何链接到Silex中的PDF文件?(How do I link to a PDF file in Silex?)

我看了一下,似乎无法弄清楚如何在使用Silex时链接到静态文件。 我已经看到了一些关于Symfony的类似问题/答案,但它们涉及YML路由文件,我不与Silex一起使用。

我的情况

我在/ docs文件夹中有一些文件。 登录用户可以上传新的pdf文件(因此,我不知道所有文件名将会是什么;它们会不断变化)。

我的意图

我需要能够链接到这些PDF文件,以便点击链接某处将打开www.myurl.com/docs/myfile.pdf。

问题

由于silex中的路由系统,它将url视为路由(显然)并抛出Page Not Found错误。

提前感谢您的任何反馈!


I've looked around a bit and can't seem to figure out how to link to a static file while using Silex. I've seen some similar questions/answers in regards to Symfony, but they involved YML routing files, which I don't use with Silex.

My Situation

I have some files in a /docs folder. Logged in users can upload new pdf files (so, I don't know ahead of time what all of the filenames will be; they're constantly changing).

My Intent

I need to be able to link to these PDF files, so that a click on a link somewhere will open www.myurl.com/docs/myfile.pdf.

The Problem

Due to the routing system in silex, it treats the url as a route (obviously) and throws a Page Not Found error.

Thanks in advance for any feedback!


原文:
更新时间:2022-11-15 18:11

最满意答案

最终为我(而不是Cygwin)工作的是从http://tdm-gcc.tdragon.net/download下载TDM MinGW-w64并设置PATH使得来自C:\TDM-GCC-64\bin gcc是用过的。


What finally worked for me (instead of Cygwin) is to download TDM MinGW-w64 from http://tdm-gcc.tdragon.net/download and set the PATH such that gcc from C:\TDM-GCC-64\bin is used.

相关问答

更多
  • 所以问题是,为了让交叉编译器正确地找到它的头和库,它需要一个--sysroot选项 ,在你的情况下--sysroot /am335x_toolchain/添加到CGO_CFLAGS和CGO_LDFLAGS。 So the problem is that for the cross-compiler to properly find its headers and libraries it needs a --sysroot option, in your case --sysroot /am335x_too ...
  • 标志-lGL是链接到opengl库,但在Windows上,opengl库称为opengl32 ,而不是libgl。 所以你不应该使用-lGL ,如果你已经在opengl32中进行了连接,那么这就是你所需要的。 The flag -lGL is to link to the opengl library, but on Windows the opengl library is called opengl32, not libgl. So you shouldn't use -lGL and if you'r ...
  • 我设法得到了一些今天的工作,尽管我可以在这里分享它,对于将来有类似问题的任何人。 我通过在cygwin64安装上设置ssh服务器并允许本地主机连接来解决第一个问题。 然后,我通过RubyMine设置了一个“远程解释器” ,并通过ssh连接将它链接到ruby解释器。 找到宝石后,RubyMine不再抱怨未知文件,代码完成工作,对我来说是成功的! 然后我搜索了一下,找到了cmd一个替代方案,不允许命令如bundler , gem等。我没有修复它,但我设法将RubyMine的终端连接到我的cygwin64终端 。 ...
  • 我一直使用boost,但我从不需要安装它。 所以我要建议我的方式,你可以选择(注意,我正常使用msvc编译器,所以我用gcc替换每个msvc,如果我错了请纠正我。如果你想使用msvc ,记得运行msvc命令提示符或在任何事情之前运行vcvarsall.bat): 你运行引导程序: bootstrap.bat gcc 然后你编译: b2 --build-type=complete stage runtime-link=static --toolset=gcc 您是否想要静态是您的选择。 现在,您可以创建一 ...
  • 我重现了这个问题,然后展示了如何解决它: mdorey@VXD0141 ~/tmp $ cat avajjni/AvajJNI.java package avajjni; public class AvajJNI { static{ //Environment (1) //System.load("D:\\cpro\\c_jni_library\\dist\\Debug\\MinGW_32-Windows\\libc_jni_library.dll"); //Environ ...
  • /usr/local/MATLAB/R2015a/bin/glnx86 不是 /usr/local/MATLAB/R2015a/bin/glnxa64/ 注意glnxa64中的glnxa64 。 /usr/local/MATLAB/R2015a/bin/glnx86 is not /usr/local/MATLAB/R2015a/bin/glnxa64/ Note the a in glnxa64.
  • 实际上有两组项目,即库和实际的工具链。 我安装了库而不是工具链。 这些库是:gcc-mingw-g ++ mingw64-i686-gcc是工具链 我运行这个命令,它运行正常: i686的-PC-的mingw32-G ++ i686的-W64-的mingw32-G ++ 要么: i686-w64-mingw32-g ++ -mwindows -static -I / opt / jdk / include -I / opt / jdk / include / win32 -Wl, - add-stdcall ...
  • 问题出在Makefile.am的-all-static选项。 Arch Linux不提供静态库(而debian目前的稳定版本也是如此)。 The problem was with the -all-static option in the Makefile.am. Arch Linux doesn't ship the static libraries (while debian's current stable release does).
  • 最终为我(而不是Cygwin)工作的是从http://tdm-gcc.tdragon.net/download下载TDM MinGW-w64并设置PATH使得来自C:\TDM-GCC-64\bin gcc是用过的。 What finally worked for me (instead of Cygwin) is to download TDM MinGW-w64 from http://tdm-gcc.tdragon.net/download and set the PATH such that gcc ...
  • makefile正在生成一个链接命令,其中包含: ... -l -L/usr/lib ... makefile中的link命令可能在此处指定为-l$(SOMEVARIABLE) ,并且由于某种原因未设置变量,因此它将作为空字符串展开。 因此,这被解释为与一个名为“-L / usr / lib”的共享库链接的指令,当然这完全是假的。 不幸的是,没有可以推送的通用魔术按钮,并修复此错误。 有必要调查在此程序包的配置和/或构建过程中发生的问题并进行修复。 The makefile is generating ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。