gpt4 book ai didi

php CLI 参数问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:21:26 26 4
gpt4 key购买 nike

我正在为 php 应用程序编写命令行脚本。

我无法让它成功接受参数。

(通过 ssh)
如果我输入:
/: php testFile.php arg1 arg2 arg3

我收到以下错误:注意: undefined variable :/testFile.php 中的 agrc 第 3 行注意: undefined variable :/testFile.php 中第 3 行的 agrv

这是当前代码:

<?php
echo ini_get('register_argc_argv');
print_r( $agrc );print_r( $agrv );
?>

我还确认了“register_argc_argv”指令是 TRUE

我在看什么?

提前致谢。

最佳答案

使用 $_SERVER['argv'] 而不是仅使用 $agrv

关于php CLI 参数问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21006517/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com