$argv
(PHP 4, PHP 5, PHP 7)

$argv — Array of arguments passed to script

<?php
  var_dump($argv);
?>

php script.php arg1 arg2 arg3
//结果
array(4) {
  [0]=>
  string(10) "script.php"
  [1]=>
  string(4) "arg1"
  [2]=>
  string(4) "arg2"
  [3]=>
  string(4) "arg3"
}

标签: $argv

添加新评论