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

解析错误:语法错误,/ 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.

 解析错误:语法错误,/ server.php.
中的意外T_STRING  code>  
 
 

该行显示如下; p>

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

我相信我得到这个是因为 p>

 &lt;?= $ s  ['ip'];?&gt; 
  code>  pre> 
 
 

第一个代码中的T_STRING是否有任何解决方法,因为它非常令人沮丧。 我已经遍布这个地方并且找不到多少。 p>

我正在使用数据库从其他服务器获取IP。 p>

提前致谢。 p> div>

$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/