Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Phoenix中通配符路由的路径帮助器(Elixir)_Elixir_Phoenix Framework - Fatal编程技术网

Phoenix中通配符路由的路径帮助器(Elixir)

Phoenix中通配符路由的路径帮助器(Elixir),elixir,phoenix-framework,Elixir,Phoenix Framework,我想为通配符路由使用路径帮助器,定义如下: get("/thing/*sub_path", ThingController, :index) 确实存在路径帮助器,但它确实不是我所需要的: iex(3)> MyAppWeb.Router.Helpers.thing_path(MyAppWeb.Endpoint, :index, sub_path: "test/thing") "/thing?sub_path=test%2Fthing" 相反,我需要的是: "/thing/test/thi

我想为通配符路由使用路径帮助器,定义如下:

get("/thing/*sub_path", ThingController, :index)
确实存在路径帮助器,但它确实不是我所需要的:

iex(3)> MyAppWeb.Router.Helpers.thing_path(MyAppWeb.Endpoint, :index, sub_path: "test/thing")
"/thing?sub_path=test%2Fthing"
相反,我需要的是:

"/thing/test/thing"
有没有关于如何实现这一目标的线索?

试试以下方法:

get("/thing/*sub_path", ThingController, :index)
这是:

MyAppWeb.Router.Helpers.thing_path(MyAppWeb.Endpoint, :index, ["test", "thing"])
例如: