简体   繁体   English

PHP-当我放置一个包含斜杠的值时,Restler返回404

[英]PHP - Restler returns 404 when I put a value that contains a slash

I am using Restler and I have a function that receive a string. 我正在使用Restler,并且我有一个接收字符串的函数。 That string may contain a slash. 该字符串可能包含斜线。 Example: "/a/b/id" 示例:“ / a / b / id”

http://test/test.json//a/b/id

Whenever I use a slash in the field it returns a 404 每当我在字段中使用斜杠时,它都会返回404

I am sure that the value will return something, but i really need to use slash in the string. 我确定该值将返回某些内容,但我确实需要在字符串中使用斜杠。

If I try to use the id by itself, no slash, it returns the correct value, but to do that I put the slashs hardcoded (not cool) 如果我尝试单独使用id(不带斜杠),它将返回正确的值,但为此我将斜杠进行了硬编码(不很酷)

http://test/test.json/id

Any tips? 有小费吗?

Is this a bug? 这是错误吗?

thanks 谢谢

When you know that your parameter may contain slash, avoid using them as url parameter 当您知道参数中可能包含斜杠时,请避免将其用作url参数

make them as query string or body parameter instead 使它们成为查询字符串或主体参数

here is an example http://restler3.luracast.com/examples/_001_helloworld/say/hello?to=slash/slash 这是一个示例http://restler3.luracast.com/examples/_001_helloworld/say/hello?to=slash/slash

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM