这似乎应该工作,但我得到404错误.
我的应用程序如下所示:
LIB /的init.php:
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/../views',
));
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
Run Code Online (Sandbox Code Playgroud)
和web/index.php:
require_once __DIR__.'/../lib/init.php';
$app->get('/about', function() use ($app) {
return $app['twig']->render('about.twig.html');
})
->bind('about');
$app->get('/', function() use ($app) {
return $app['twig']->render('index.twig.html');
})
->bind('homepage');
$app->run();
Run Code Online (Sandbox Code Playgroud)
我正在使用MAMP在我的本地机器上进行测试.当我访问localhost:8888/web时,它会使索引页面正常,没有问题,但访问localhost:8888/web/about会出现404错误.
这里发生了什么?