How to determine if a PHP file is loaded via cron/command line -


I need to determine whether the code is being loaded into the code via the cron or command line or No. How can I do this?

If you have control over the cron or command, the command line argument, and it $ _ SERVER ['argv'] [0] ? Reading script with

  * * * * * / usr / bin / php / path:  
  & lt ;? Php if (- ($ _ SERVER ['argv'] [0] / / / script - cron  

) and $ _SERVER ['argv'] [0] == ' -Cron ') $ I_AM_CRON = True; And $ I_AM_CRON = false;


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -