2014-12-08 12:36
浏览 59


I'd like to know whether it is possible to have PHP run commands on a set loop, without the need of a user to be actively viewing it on a browser.

For example, mail sending - I'd like to be able to have this loop run, even when I close the browser, until I command it to stop.

$name = "Foo";
$to = $row['email'] //imagine it was fetched from a database;
mail($to,"Hello ".$name."! you won a million dollars!","Just kidding!");

After looking it up, I've noticed that some people mentioned it is possible to run PHP scripts as processes, I'd love to know if such a thing can be done, and if so I'd appreciate any help regarding the case

Thanks in advance!

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

1条回答 默认 最新