Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.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
Php FosRestBundle故障与get路径_Php_Symfony_Fosrestbundle - Fatal编程技术网

Php FosRestBundle故障与get路径

Php FosRestBundle故障与get路径,php,symfony,fosrestbundle,Php,Symfony,Fosrestbundle,我对FosRestBundle有问题,我定义了以下路线: /** * @Get("/resetpassword/{mail}", requirements={"mail"=".+"}) * @param $mail * * @return Response */ public function getResetPasswordUserAction($mail) 问题是$mail变量包含“/resetpassword”/myemail@gmail.com“,您知道为什么会选择var中

我对FosRestBundle有问题,我定义了以下路线:

 /**
 * @Get("/resetpassword/{mail}", requirements={"mail"=".+"})
 * @param $mail
 *
 * @return Response
 */
public function getResetPasswordUserAction($mail)
问题是$mail变量包含“/resetpassword”/myemail@gmail.com“,您知道为什么会选择var中的路由路径吗

fos_rest:
param_fetcher_listener: true
body_listener: true
format_listener: true
view:
    view_response_listener: 'force'
    formats:
        xml: true
        json : true
    templating_formats:
        html: true
    force_redirects:
        html: true
    failed_validation: HTTP_BAD_REQUEST
    default_engine: twig
routing_loader:
    default_format: json
    include_format: false
谢谢,

编辑

我发现了这个问题,我还有一个方法可以让用户发送电子邮件:

 /**
 * @Get("/{mail}", requirements={"mail"=".+"})
 * @param $mail
 *
 * @return Response
 */
public function getUserAction($mail)
因此,当我尝试执行重置密码操作时,调用了get user操作,并且在url路径上出现了一部分错误。但我仍然不明白为什么这是通过我的其他功能,但第一个参数传递


无论如何,我已经删除了需求部分,现在它可以正常工作了,所以如果您有同样的问题,请记住行为奇怪的需求。

检查了您的操作,它会为我返回电子邮件,可能是配置中的问题。我有一个基本配置:
fos\u rest:param\u fetcher\u listener:true body\u listener:true format\u listener:true view:view\u response\u listener:'force'格式:xml:true json:true templating\u格式:html:true强制重定向:html:true失败\u验证:HTTP\u错误\u请求默认\u引擎:细枝路由\u加载程序:默认\u格式:json包含\u格式:false
谢谢@ArtemZhuravlev但我发现了问题,请查看“编辑”部分。引起麻烦的是需求参数。