解析错误:语法错误,/ server.php中的意外T_STRING [关闭]

Parse error: syntax error, unexpected T_STRING in /server.php.

The line shows as follows;

$data = file_get_contents('http://awebsite.com/status?server_ip=<?=$s['ip'];?>&clean=true');

I believe I am getting this because of

<?=$s['ip'];?>

Are there any work arounds for the T_STRING in the first code as it is quite frustrating. I have looked all over the place and can't find much on this.

I am using a database to fetch IPs from other servers.

Thanks in advance.

$data = file_get_contents("http://awebsite.com/status?server_ip={$s['ip']}&clean=true");

Try using string concatenation:

$data = file_get_contents('http://awebsite.com/status?server_ip='.$s['ip'].'&clean=true');

Also, for future reference read the following article on why underscores are not recommended for URLs

http://blog.woorank.com/2013/04/underscores-in-urls-why-are-they-not-recommended/