小编Man*_*ena的帖子

PHP 中的连接 URL

当我尝试将变量与 URL 连接时遇到问题

这有效:

$id = 123;
$url = file_get_contents("http://127.0.0.1:8080/api/table.json?output=html&udptype=trap&udpmsgid=".$id."&content=udpmessage");
Run Code Online (Sandbox Code Playgroud)

但这不起作用

$id = $_GET['id'];
$url = file_get_contents("http://127.0.0.1:8080/api/table.json?output=html&udptype=trap&udpmsgid=".$id."&content=udpmessage");
Run Code Online (Sandbox Code Playgroud)

我不知道我是否正确连接了变量。

php url concatenation file-get-contents

0
推荐指数
1
解决办法
1524
查看次数

标签 统计

concatenation ×1

file-get-contents ×1

php ×1

url ×1