我是这个领域的新手。出于某种原因,当我把>代码中的任何位置的符号,它后面的每一段代码都在浏览器中显示为文本。我无法在任何地方找到答案。
<html>
<head>
<title>Site Title</title>
</head>
<body>
<?php
$curl = curl_init("https://xboxapi.com/v2/messages");
$headers = array();
$headers[] = 'X-AUTH: key';
$headers[] = 'Content-Type: application/json';
$data = array(
"to" => "{user}",
"message" => "test"
);
$json = json_encode($data);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec ($curl);
curl_close ($curl);
print $server_output
?>
</body>
</html>