I use Phalcon\Mvc\Micro\Collection to set up routing .here is my code:
<?php
use Phalcon\Mvc\Micro\Collection;
return call_user_func(function () {
$rules['grade'] = new Collection();
$rules['grade']->setHandler('\Api\Grade')->setPrefix('/api/v1/user/{uuid:[a-zA-Z0-9]+}/grades')->setLazy(true);
$rules['grade']->post('/{classId:[0-9]+}/apply', 'apply');
return $rules;
}
?>
https://localhost:8080/api/v1/user/0cafdf577605/grades/1/apply
<?php
namespace Api\Grade;
var_dump($this->request->getQuery());//result: array(1) { ["_url"]=> string(40) "/api/v1/user/0cafdf577605/grades/1/apply" }
var_dump($this->request->get());//result: array(1) { ["_url"]=> string(40) "/api/v1/user/0cafdf577605/grades/1/apply" }
var_dump($this->request->getPost());//result: array(0) { }
?>
I want to get the value of the classId .What should I do?