无法在Symfony控制器脚本中访问数组内的数量元素

时间:2018-07-26 04:33:49

标签: php symfony

在我的symfony控制器脚本中,我传递了购物车的数量。而且我能够获得print_r如下。我面临的问题是我尝试了各种方法来获取数量而没有成功,可以帮助我如何获取此数量元素

public function detailsAction($id, Request $request)
{
    $book = $this->getDoctrine()
        ->getRepository('AppBundle:Booklist')
        ->find($id);
    print_r($request->request->get('form'));
    die($request->request->get('form'));      

    return $this->render('books/details.html.twig', array('book' => $book, 'quantity' => 1));
}

使用print_r

输出
Array ( [quantity] => 1 [Add to Cart] => [_token] => Y8XHbH7lHphAFQ5lIjhQShoIleeSj9iGpen1rhxTBz4 ) Array

有人可以帮助我获取数量吗?

1 个答案:

答案 0 :(得分:1)

您已抛弃GLuint shader_prog = .... ; // shader program object float width = .... ; // viewport width in pixel float height = .... ; // viewport height in pixel float prj_mat[] = { 2.0f/width, 0.0f, 0.0f, 0.0f, 0.0f, -2.0f/height, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, -1.0f, 1.0f, 0.0f, 1.0f }; glLinkProgram( shader_prog ); GLint prj_loc = glGetUniformLocation( shader_prog, "u_projection" ); glUseProgram( shader_prog ); glUniformMatrix4fv( prj_loc, 1, GL_FALSE, prj_mat ); ,其中有数量。数量应该很容易。

$request->request->get('form')