【问题标题】:in slim how can I pass a file path into a variable?在苗条中,如何将文件路径传递给变量?
【发布时间】:2013-04-17 02:48:59
【问题描述】:

我现在拥有的是:

$app->get(/folderBrowse/:path function($app){
bla bla bla 

}); // I know this is not using '' or , 
but it's just for example, because I've tried it with many configurations. my 
syntax is correct in my code, because it works fine when I don't pass a path

但是当我传递一个文件路径时,即使使用 URL 编码它也会给我一个 404 页面。有什么我想念的吗?

任何帮助将不胜感激。

【问题讨论】:

  • 如果你有正确的语法在这里贴出来,问语法错误的目的是什么?
  • 我的意思不是说我有错误的语法...我想说我并不想具体说明我的语法...我知道它有效。感谢您的回复。我试图弄清楚如何通过带有 slim 的 URL 传递文件路径......当我这样做时它总是给我一个 404 错误......即使我使用 url 编码方法。我需要更改 slim 中的某些设置吗?

标签: php get urlencode filepath slim


【解决方案1】:

现在您可以像这样通过 url 发送文件路径等内容

http://localhost/api/something?file_path=some url encoded string

$app->get('/something', function() use($app) {
  $file_path = $app->request()->get('file_path');
call some other stuff... etc

}); 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-02
    • 1970-01-01
    • 2022-10-17
    • 1970-01-01
    • 2023-01-18
    相关资源
    最近更新 更多