reserved.variables.argv.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 82 行

HTML
82
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Array of arguments passed to script</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="reserved.variables.html">Predefined variables</a></div> <div class="next" style="text-align: right; float: right;"><a href="reserved.exceptions.html">Predefined Exceptions</a></div> <div class="up"><a href="reserved.variables.html">Predefined variables</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="reserved.variables.argv" class="refentry"> <div class="refnamediv">  <h1 class="refname">$argv</h1>  <p class="refpurpose"><span class="refname">$argv</span> &mdash; <span class="dc-title">Array of arguments passed to script</span></p> </div>  <div class="refsect1 description">  <h3 class="title">Description</h3>  <p class="para">   Contains an <a href="language.types.array.html" class="type array">array</a> of all the arguments passed to the script when running   from the <a href="features.commandline.html" class="link">command line</a>.  </p>  <blockquote><p><b class="note">Note</b>:    <span class="simpara">    The first argument is always the current script&#039;s filename, therefore    <var class="varname">$argv[0]</var> is the script&#039;s name.   </span>  </p></blockquote>  <blockquote><p><b class="note">Note</b>:    <span class="simpara">    This variable is only available when <a href="ini.core.html#ini.register-argc-argv" class="link">register_argc_argv</a>    is enabled.   </span>  </p></blockquote> </div>  <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example" id="variable.argv.basic" name="variable.argv.basic">    <p><b>Example #1 <var class="varname">$argv</var> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$argv</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>    <div class="example-contents"><p>     When executing the example with: php script.php arg1 arg2 arg3    </p></div>    <div class="example-contents"><p>The above example will output something similar to:</p></div>    <div class="example-contents"><pre><div class="cdata"><pre>array(4) {  [0]=&gt;  string(10) &quot;script.php&quot;  [1]=&gt;  string(4) &quot;arg1&quot;  [2]=&gt;  string(4) &quot;arg2&quot;  [3]=&gt;  string(4) &quot;arg3&quot;}</pre></div>    </pre></div>   </div>  </p> </div> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="reserved.variables.html">Predefined variables</a></div> <div class="next" style="text-align: right; float: right;"><a href="reserved.exceptions.html">Predefined Exceptions</a></div> <div class="up"><a href="reserved.variables.html">Predefined variables</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?