Validating Crontab Entries with PHP

后端 未结 7 1137
青春惊慌失措
青春惊慌失措 2020-11-29 05:43

What is the best way to validate a crontab entry with PHP? Should I be using a regex, or an external library? I\'ve got a PHP script that adds/removes entries from a crontab

7条回答
  •  粉色の甜心
    2020-11-29 05:57

    Use the pattern: /^((?:[1-9]?\d|\*)\s*(?:(?:[\/-][1-9]?\d)|(?:,[1-9]?\d)+)?\s*){5}$/

    In PHP:

提交回复
热议问题