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

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -