0
大家。我有一个需要从终端或命令提示符运行的脚本。我使用PHP。 GetOpt
是我用来从终端获取用户输入的数据或参数的函数。GetOpt没有阅读完整的URL
这是我的脚本。
<?php
$opt = getopt("f:");
$input = $opt['f'];
$u = fopen($input, 'r');
echo "\n\n$input\n\n";
我尝试这样运行:
$ php myscript.php -f http://myurl.com/file.csv?city=london&status=3
我的网址http://myurl.com/file.csv?city=london&status=3
,但只输出http://myurl.com/file.csv?city=london
。状态参数从完整网址丢失。
有人知道吗?或者有任何想法来解决它?让分享。先谢谢了!
不错。你有想法,使网址转换为报价? “$输入”? –
@IWayanDharmana这是你手动输入bash的东西,不是吗?如果不是,这是另一个问题。 –
是的,没有办法很酷。谢谢。 –