routes - How sending parameter in the controller method of Silex - PHP -
i'm using silex , i'm trying pass parameter controllers , not work.
my code below:
<?php error_reporting(e_all); ini_set('display_errors', 1); require_once __dir__ . '/vendor/autoload.php'; use silex\application; use symfony\component\httpfoundation\request; class testcontroller { public function testaction(request $request, application $app, $value) { var_dump($value); return 'test'; } } $app = new application(); $app['debug'] = true; $app->get('/{value}', 'testcontroller::testaction'); $app->run();
your code correct.
that's 404 error apache. need call page http://site/index.php/value
. if want remove index.php
url follow page.
Comments
Post a Comment