亲爱的,
我如何使用php file_get_content函数发送参数.
$id='123';
$name='blah';
$response=file_get_contents('http://localhost/abc/abc.php?id=$id&name=$name');
echo $response;
Run Code Online (Sandbox Code Playgroud)
我需要将$ id和name值发送到abc.php页面.这里传递的值不起作用.还是我chk?id ="$ id"&name ="$ name"value.It也不起作用.但是straite参数有效 .say-
$response=file_get_contents('http://localhost/abc/abc.php?id=123&name=blah');
Run Code Online (Sandbox Code Playgroud)
现在是他们的善良心脏谁可以帮我发送2个参数$ id和$ name给abc.php?
由于
里亚德
单引号禁止变量替换.
$response=file_get_contents("http://localhost/abc/abc.php?id=$id&name=$name");
Run Code Online (Sandbox Code Playgroud)
不要忘记对所有参数进行URL编码.