2015-07-12 23:43 阅读 49


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');


Here are the docs I'm using

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douyihuaimao733955 douyihuaimao733955 2015-07-13 00:04

    Turn debugging on by doing $app['debug'] = true;.

    If you have a .env file, also make sure it's not overwriting your default setting.

    点赞 评论 复制链接分享