我创建了以下操作:
add_action( \'test_action\', \'test_action\' );
function test_action() {
error_log( \'test_action\' );
}
我这样称呼它:error_log( \'send_test_email_in_background:START\' );
wp_schedule_single_event( time(), \'test_action\' );
error_log( \'send_test_email_in_background:END\' );
我在apache错误日志文件中收到的是:[17-Sep-2015 11:09:35 UTC] send_test_email_in_background:START
[17-Sep-2015 11:09:35 UTC] send_test_email_in_background:END
这在我的Windows PC(运行WAMP)上的开发工作与在生产(在AWS中运行Linux)上的工作完全相同。此外,如果我将单个事件安排在未来的5分钟内(time()+300),它会在我的“Debug Bar Cron”插件中显示为可以在5分钟内运行,并且运行正常。因此,似乎正在创建CRON作业,但由于某种原因,它们在运行时实际上没有调用该操作?其他人有没有遇到过这个问题或对此有什么见解?