问题
I'm trying to do what I would think is the most basic thing and it is taking too much time. I simply want my index file to point to or forward to another file. I was originally doing this with a simple one liner.
require_once getcwd() . "/web/source/index.php";
Once I migrated to Silex I tried this:
$app->get('/', function($path) use($app) {
return $app->sendFile('/web/source/index.php');
});
but there was no go.
When I go to my site I get a very descriptive "Whoops Something went wrong". How can I troubleshoot this?
Here is the full code with all the boilerplate:
require_once __DIR__ . '/vendor/autoload.php';
$app = new Silex\Application();
$app->get('/{name}', function($name) use($app) {
// this works fine
return ' test: '. $app->escape($name);
});
$app->get('/', function($path) use($app) {
// this does not
return $app->sendFile('/web/source/index.php');
});
$app->run();
Here are the docs I'm using
回答1:
Turn debugging on by doing $app['debug'] = true;
.
If you have a .env
file, also make sure it's not overwriting your default setting.
来源:https://stackoverflow.com/questions/31373665/how-do-i-troubleshoot-a-silex-application