自作PHPスクリプトをCLIやcronなどから実行する際、様々な追加情報のためにオプションを指定することがあるときは、 getopt()関数を使用します。
$shortopt = "";
$shortopt .= "s:" #値必須
$shortopt .= "r::" #値必須ではない
$options = getopt($shortopt);
# $optionsには{"s" => "hoge", "r" => Null}のような連想配列が返されます。
自作PHPスクリプトをCLIやcronなどから実行する際、様々な追加情報のためにオプションを指定することがあるときは、 getopt()関数を使用します。
$shortopt = "";
$shortopt .= "s:" #値必須
$shortopt .= "r::" #値必須ではない
$options = getopt($shortopt);
# $optionsには{"s" => "hoge", "r" => Null}のような連想配列が返されます。