💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# php命令行 - 接收参数 ``` <pre class="calibre14">``` <span class="token5">function</span> <span class="token1">adds</span><span class="token2">(</span><span class="token2">)</span><span class="token2">{</span> $args <span class="token">=</span> <span class="token1">func_get_args</span><span class="token2">(</span><span class="token2">)</span><span class="token2">;</span> $n <span class="token">=</span> <span class="token1">func_num_args</span><span class="token2">(</span><span class="token2">)</span><span class="token2">;</span> <span class="token1">dump</span><span class="token2">(</span>$args<span class="token2">)</span><span class="token2">;</span> <span class="token2">}</span> <span class="token1">adds</span><span class="token2">(</span><span class="token3">1</span><span class="token2">,</span><span class="token3">2</span><span class="token2">,</span><span class="token3">3</span><span class="token2">,</span><span class="token3">4</span><span class="token2">)</span><span class="token2">;</span> php task<span class="token2">.</span>php <span class="token">-</span>i <span class="token3">2</span> <span class="token1">getopt</span><span class="token2">(</span><span class="token4">"i:"</span><span class="token2">)</span> 返回数组 <span class="token2">[</span><span class="token4">"i"</span><span class="token2">]</span> 推荐方式 $argc 是参数个数 $argv 数组<span class="token2">,</span><span class="token3">0</span>是文件名<span class="token3">1</span>是参数<span class="token">-</span>i <span class="token3">2</span>是值<span class="token3">2</span> ``` ``` - 宝塔定时任务,后面是传递参数 ``` <pre class="calibre16">``` cd <span class="token">/</span>www<span class="token">/</span> php task<span class="token2">.</span>php <span class="token">-</span>i <span class="token3">2</span> php <span class="token">-</span>S localhost<span class="token2">:</span><span class="token3">8000</span> 自带服务器命令启动 ``` ```