📄 reserved.variables.argc.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>The number 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.httpresponseheader.html">$http_response_header</a></div> <div class="next" style="text-align: right; float: right;"><a href="reserved.variables.argv.html">$argv</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.argc" class="refentry"> <div class="refnamediv"> <h1 class="refname">$argc</h1> <p class="refpurpose"><span class="refname">$argc</span> — <span class="dc-title">The number of arguments passed to script</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <p class="para"> Contains the number of arguments passed to the current 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 script's filename is always passed as an argument to the script, therefore the minimum value of <var class="varname">$argc</var> is <i>1</i>. </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.argc.basic" name="variable.argc.basic"> <p><b>Example #1 <var class="varname">$argc</var> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$argc</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></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>int(4)</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.httpresponseheader.html">$http_response_header</a></div> <div class="next" style="text-align: right; float: right;"><a href="reserved.variables.argv.html">$argv</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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -