Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法在php$\u GET中传递多个参数_C#_Php_Iis - Fatal编程技术网

C# 无法在php$\u GET中传递多个参数

C# 无法在php$\u GET中传递多个参数,c#,php,iis,C#,Php,Iis,我有以下php代码作为http服务器的代理 slavePref.php <?php $url = 'http://xyzdei/IPDWSRest/Service1.svc/getServerUtil'; $callback = $_GET["callback"]; echo($callback . "("); header('Content-Type: application/json; charset=utf8'); echo(file_get

我有以下php代码作为http服务器的代理

slavePref.php

<?php
    $url = 'http://xyzdei/IPDWSRest/Service1.svc/getServerUtil';

    $callback = $_GET["callback"];
    echo($callback . "(");
    header('Content-Type: application/json; charset=utf8');
    echo(file_get_contents($url . '/' . $_GET["poolingServer"], $_GET["serverPID"]));

    echo (")");
    ?>
从浏览器中,我试图将uri称为

http://:1136/slavePerf.php?poolgserver=thunderw7dei&serverPID=23456


但是,请求失败,并显示以下消息

>


。我认为我没有正确地传递参数

您没有设置名为“callback”的参数,因此它没有在$\u GET变量中设置

您可以通过执行以下操作修复错误消息:

$callback = "";
if(array_key_exists('callback', $_GET) == TRUE){
    $callback = $_GET['callback'];
}
并在url中添加“&”:

echo(file_get_contents($url . '/' . $_GET["poolingServer"] . '&' . $_GET["serverPID"]))

当我修改php文件以获取文件内容时,问题得到了解决

echo(file_get_contents($url . '/' . $_GET["poolingServer"]));
还有我的乌里托

[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "getServerUtil/{poolingServer}/{serverPID}", ResponseFormat = WebMessageFormat.Json, Method = "GET")]

“但是请求失败”->Errormessage?@EdiG。我已更新错误消息URL中的请求部分是否有参数
回调
?@sameerkarjatkar然后URL中没有回调参数存在问题,您正在尝试获取不存在的参数的valueTest:URL和echo$URL。“/”$_获取[“池服务器”]。&'$_获取[“服务器PID”];现在它的报告警告:file\u get\u contents():无法打开流:HTTP请求失败!HTTP/1.1 400 C:\Users\xom\Documents\My Web Sites\EmptySite2\slavePerf.php中的错误请求第8行是我在Web服务中的uri模板。请更正UriTemplate=“getServerUtil/{PooligsServer}&{serverPID}”php响应是file\u get\u contents():无法打开流:HTTP请求失败!对于url
echo(file_get_contents($url . '/' . $_GET["poolingServer"]));
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "getServerUtil/{poolingServer}/{serverPID}", ResponseFormat = WebMessageFormat.Json, Method = "GET")]