duaedf6509 2014-10-16 12:54
浏览 42

Laravel App:在未调用函数之前

I am having a problem with an application running Laravel 4.1 and trying to get filters working.

Within my filters file I have the following code residing in my filters.php:

echo 'here1';
App::before(function($request)
{
    die('here2');
    //
});

When I make a request to the application in my browser, then I get the first echo but I can't get the die to work indicating that this function is not being run.

I am not getting errors on screen or in the logs.

Can anybody shed any light as to why this before function is not being called?

Many thanks, G.

  • 写回答

1条回答 默认 最新

  • donglv9813 2014-10-16 13:20
    关注

    Matt Burrow pointed me in the right direction.

    Filters are in fact disabled in testing mode as standard in Laravel (thank you Laravel documentation for making this obvious).

    So, I put the following code into the configuration file for my testing environment and the filters started working:

    Route::enableFilters();
    

    Many thanks, G.

    评论

报告相同问题?

悬赏问题

  • ¥15 对于这个问题的代码运行
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败