使用ant,如何打开具有多个参数的url
我正在使用:使用ant,如何打开具有多个参数的url,ant,Ant,我正在使用: <exec executable="cmd"> <arg line="${argLine}" /> </exec> 有两个参数,我使用&转义和符号 但只打开http://127.0.0.1/product/findSameStyleSku.json?skuId=305 样式参数丢失 简而言之,我想跑步 <target name="111test"> <exec executable="cmd" output="
<exec executable="cmd">
<arg line="${argLine}" />
</exec>
有两个参数,我使用&代码>转义和符号
但只打开http://127.0.0.1/product/findSameStyleSku.json?skuId=305
样式
参数丢失
简而言之,我想跑步
<target name="111test">
<exec executable="cmd" output="e:/test.txt">
<arg line="/c start '' 'http://127.0.0.1/product/findSameStyleSku.json?skuId=305&%3bstyle=120662'" />
</exec>
</target>
我将“&;%3b
”更改为“&;
”
也只开放
http://127.0.0.1/product/findSameStyleSku.json?skuId=305
http://127.0.0.1/product/findSameStyleSku.json?skuId=305
但在cmd中,我使用
start "" "http://127.0.0.1/product/findSameStyleSku.json?skuId=305&style=120662"
可以打开http://127.0.0.1/product/findSameStyleSku.json?skuId=305&style=120662
不完全理解它试图打开的内容。它实际上是想用***?skuId=305
打开一个URL,还是说它想打开你放弃的URL,但不包括分号
如果你说它省略了URL的最后一部分,你应该明白分号不能是你发送的实际URL的一部分。它们是并且必须经过特殊编码的
确保分号甚至假定在那里。当您执行GET请求时,您有一个基本URL,然后在该URL之后有一个问号。在这之后,将有一系列参数传递到URL,每个参数用符号分隔。在您的情况下,您似乎希望向URL发送请求:
http://127.0.0.1:/product/findSameStyleSku.json
使用以下两个参数:
skuId
=305
style
=120662
看来分号是假的。否则,您将传递参数;样式
和非样式
。而且,这似乎并不正确
如果您确定分号确实存在,请尝试将URL中的分号替换为%3b
:
<property name="argLine" value="http://127.0.0.1:/product/findSameStyleSku.json?skuId=305&%3bstyle=120662"/>
在你的帖子后面,你说你想跑步:
C> cmd /c start '' 'http://127.0.0.1/product/findSameStyleSku.json?skuId=305&%3bstyle=120662'
第一种方法在命令行中肯定不起作用。第二个呢
我已经在我当前的计算机上使用以下方法进行了一些测试:
<property name="argLine"
value="http://etzahaim.org/index.php?option=com_content&task=blogcategory&id=15&Itemid=34"/>
<exec executable="curl">
<arg value="${argLine}"/>
<arg value="--include"/>
<arg value="--output"/>
<arg value="curl.out"/>
</exec>
我想表达背后的含义,但是,当我执行时,Ant build失败,警告:对实体“amp”的引用必须以“;”结尾分隔符。@feilong--对不起,我打错了。我将&
更改为&代码>。现在答案应该是正确的。@feilong看到我原来的回复了吗answer@feilong我想我一定是错过了什么。您是否尝试过通过--verbose
或--debug
开关运行ant,以查看这是否提供了更多信息。你能用URL设置一个属性,然后打印出那个URL吗?
C> cmd http://127.0.0.1:/product/findSameStyleSku.json?skuId=305&style=120662
C> cmd /c start '' 'http://127.0.0.1/product/findSameStyleSku.json?skuId=305&%3bstyle=120662'
<property name="argLine"
value="http://etzahaim.org/index.php?option=com_content&task=blogcategory&id=15&Itemid=34"/>
<exec executable="curl">
<arg value="${argLine}"/>
<arg value="--include"/>
<arg value="--output"/>
<arg value="curl.out"/>
</exec>
<target name="111test">
<exec executable="cmd" output="e:/test.txt">
<arg value="/c"/>
<arg value="start"/>
<arg value=""/>
<arg value="${argline}" />
</exec>