在slim中如何将文件路径传递给变量?

时间:2013-04-17 02:48:59

标签: php get urlencode filepath slim

我现在拥有的是:

$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页面。有什么我想念的东西。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

现在您可以通过网址发送文件路径之类的内容,例如

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

});