dsgdg54ef4365
2018-01-30 05:28
浏览 35
已采纳

调用未定义的方法Base :: grab()[无胖框架]

I'm trying to set-up a cronjob. I have followed this tutorial here on configuring cronjob with fat-free framework. I have put "cron.php" file in "path/to/app/lib" folder. And my index.php file is :

<?php
require __DIR__ . '/vendor/autoload.php';
$f3 = require('lib/base.php');
$cron = Cron::instance();
$cron->set('lunchAlert','GBD\Internals\Controllers\LunchController->sendAlertNotificationsUsers','* * * * *');

$f3->run();

Here's my controller script:

public function sendAlertNotificationsUsers()
{
    echo "hello world";
}

Here's how I installed my job in crontab:

crontab -e

* * * * * cd /var/www/html/dev-portal-new; php index.php /cron

But I'm getting this mail :

PHP Fatal error:  Call to undefined method Base::grab() in /var/www/html/dev-portal-new/lib/cron.php on line 110
HTTP Fatal error: Call to undefined method Base::grab() (GET /cron)

What do I do to add this Base::grab() method? Anyone here on fat-free framework? Any help is very much appreciated. Thanks.

图片转代码服务由CSDN问答提供 功能建议

我正在尝试设置一个cronjob。 我已经在这个教程中使用无脂框架配置cronjob。 我已将“cron.php”文件放在“path / to / app / lib”文件夹中。 我的index.php文件是:

 &lt;?php \  nrequire __DIR__。  '/vendor/autoload.php';
$f3 = require('lib / base.php'); 
 $ cron = Cron :: instance(); 
 $ cron-&gt; set('lunchAlert',  'GBD \ Internals \ Controllers \ LunchController-&gt; sendAlertNotificationsUsers','* * * * *'); 
 
 $ f3-&gt; run(); 
   
 
  

这是我的控制器脚本:

  public function sendAlertNotificationsUsers()
 {
 echo“hello world”; 
} 
   
 
 

以下是我在crontab中安装作业的方法:

  crontab -e 
 
 * * * * * cd / var / www / html 的/ dev-门户新;  php index.php / cron 
   
 
 

但是我收到了这封邮件:

  PHP致命错误:致电 到未定义的方法Base :: grab()in /var/www/html/dev-portal-new/lib/cron.php on line 110 
 
NHTTP致命错误:调用未定义的方法Base :: grab()(GET / cron)  )
   
 
 

如何添加此Base :: grab()方法? 这里有关于无脂肪框架的人吗? 很感谢任何形式的帮助。 谢谢。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongzhenjian5195 2018-01-30 09:43
    已采纳

    You're obviously using an old version of the framework. The grab() method has been introduced in version 3.5. See https://github.com/bcosca/fatfree-core/blob/master/CHANGELOG.md

    点赞 打赏 评论

相关推荐 更多相似问题