获取被调用函数的 JsonResponse
Get JsonResponse of a called function
我正在 Symfony 网站上工作。基本上我得到了两个 return 都是 JsonResponse 的函数:
public function myFirstFunction() {
mySecondFunction();
return new JsonResponse(JsonResponse of mySecondFunction() ????);
}
public function mySecondFunction() {
return new JsonResponse(array("result" => "ok", "sent" => "yes));
}
我的问题是:myFirstFunction() 如何 return JsonResponse return 由 mySecondFunction() 编辑?
只需 return
它与 $this->
因为你在当前 object
中调用 method
。返回方法 程序样式 return mySecondFunction();
将不起作用。
public function myFirstFunction() {
return $this->mySecondFunction();
// return new JsonResponse(JsonResponse of mySecondFunction() ????);
}
public function mySecondFunction() {
return new JsonResponse( array("result" => "ok", "sent" => "yes") );
}
我正在 Symfony 网站上工作。基本上我得到了两个 return 都是 JsonResponse 的函数:
public function myFirstFunction() {
mySecondFunction();
return new JsonResponse(JsonResponse of mySecondFunction() ????);
}
public function mySecondFunction() {
return new JsonResponse(array("result" => "ok", "sent" => "yes));
}
我的问题是:myFirstFunction() 如何 return JsonResponse return 由 mySecondFunction() 编辑?
只需 return
它与 $this->
因为你在当前 object
中调用 method
。返回方法 程序样式 return mySecondFunction();
将不起作用。
public function myFirstFunction() {
return $this->mySecondFunction();
// return new JsonResponse(JsonResponse of mySecondFunction() ????);
}
public function mySecondFunction() {
return new JsonResponse( array("result" => "ok", "sent" => "yes") );
}