Php GetOpt不';无法读取完整的URL

Php GetOpt不';无法读取完整的URL,php,bash,Php,Bash,我有一个脚本需要从终端或命令提示符运行。我正在使用PHPGetOpt是我用来获取用户在终端中输入的数据或参数的函数 这是我的剧本 <?php $opt = getopt("f:"); $input = $opt['f']; $u = fopen($input, 'r'); echo "\n\n$input\n\n"; 我的url是http://myurl.com/file.csv?city=london&status=3,但它只输出http://myurl.com/file.csv?ci

我有一个脚本需要从终端或命令提示符运行。我正在使用PHP
GetOpt
是我用来获取用户在终端中输入的数据或参数的函数

这是我的剧本

<?php
$opt = getopt("f:");
$input = $opt['f'];
$u = fopen($input, 'r');
echo "\n\n$input\n\n";
我的url是
http://myurl.com/file.csv?city=london&status=3
,但它只输出
http://myurl.com/file.csv?city=london
。完整URL中的状态参数丢失


我怎样才能让它起作用呢?

这是因为你必须将你的链接用引号括起来:

$ php myscript.php -f "http://myurl.com/file.csv?city=london&status=3"
我继续假设您正在Bash中运行脚本,在您的情况下,Bash中的
&
可能被解释为按位

$ echo $(( 98 & 7 ))
2

美好的你有没有办法把url转换成quote?“$input”?@IWayanDharmana这是您在bash中手动键入的内容,不是吗?如果没有,那就换一个问题。
$ echo $(( 98 & 7 ))
2