-2

我当前的代码如下。

<?php
header('Content-Type: image/png');
header('Content-Disposition: attachment; filename="Skin"');
echo file_get_contents("http://domain.tld/script/skins/' . $_GET["m"] . '.png");
?>

我知道问题出在...
(' . $_GET["m"] . ')
...但是如何解决呢?

我收到以下错误。
解析错误:语法错误,意外的 '"',期待 T_STRING 或 T_VARIABLE 或 T_NUM_STRING 在 ...

4

2 回答 2

0

您的字符串分隔符不匹配。尝试这个:

echo file_get_contents("http://domain.tld/script/skins/" . $_GET["m"] . ".png");
于 2012-12-07T23:59:48.933 回答
0

试试这个:

echo file_get_contents("http://domain.tld/script/skins/$_GET[m].png");

您正在混合单引号和双引号:

 "http://domain.tld/script/skins/' . $_GET["m"] . '.png"
^^^                             ^^^              ^^^  ^^^
open                           close             open close

干杯

于 2012-12-08T00:00:10.207 回答