【发布时间】:2017-10-27 18:33:21
【问题描述】:
我计划向 android 和 ios 开发人员添加对 Symfony 3 数据形式的内容的访问权限。现在,访问是通过网络浏览器。我在控制器上扩展了逻辑,但通过 TWIG/HTML 页面共享很简单。 例如。
/**
* Class DefaultController
*
* @Route("/item")
*
* @package SameBundle\Controller
*/
class DefaultController extends Controller
{
/**
* Lists all Product entities.
*
* @Route("/", name="product_index")
* @Method("GET")
*
* @Template
*/
public function indexProductAction()
{
// (...)
return ['products' => $products,];
}
indexProduct.html.twig 页面支持它。
我必须向控制器/功能添加什么才能做到这一点?
【问题讨论】:
-
你应该做一个基于 JsonResponse 的 API,这样你就可以在 android 上解析它
标签: php android ios symfony web-applications