How do I troubleshoot a Silex application?

爱⌒轻易说出口 提交于 2020-03-21 20:24:35

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!