In the official documentation, here's a simple example
use Phalcon\Mvc\Micro;$app = new Micro();$app->get('/say/welcome/{name}', function ($name) { //do something});$app->handle();
All the processing code is written fcunction inside, apparently impossible,
get/say/getwelcome/{name}when accessing, want to let it instance a controller, how to do
Reply content:
In the official documentation, here's a simple example
use Phalcon\Mvc\Micro;$app = new Micro();$app->get('/say/welcome/{name}', function ($name) { //do something});$app->handle();
All the processing code is written fcunction inside, apparently impossible,
get/say/getwelcome/{name}when accessing, want to let it instance a controller, how to do
Thank you for the invitation, did not use this framework, specifically search for a bit, and then can only say please this pro carefully complete read the document. Please see //对象内的方法 section.
Hello! $name";}$app->get('/say/hello/{name}', "say_hello");// 静态方法$app->get('/say/hello/{name}', "SomeClass::someSayMethod");// 对象内的方法$myController = new MyController();$app->get('/say/hello/{name}', array($myController, "someAction"));// 匿名函数$app->get('/say/hello/{name}', function ($name) { echo "Hello! $name
";});