dsfs504545 2015-07-12 23:43
浏览 52
已采纳

如何解决Silex应用程序问题?

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条回答 默认 最新

  • 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题