我想所有的想法,但我想在这段代码中插入数据

时间:2015-08-22 15:49:16

标签: php

当我添加这个http:// <? echo $rows["p_ip"]时,不要把行p_ip取给我 电话中有错误请帮帮我

$url = 'http://<? echo $rows["p_ip"]';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpcode>=200 && $httpcode<300){
  echo '<b style="margin-left:5px;background-color:#6cc369;">worked</b>';
} else {
  echo "<b style='margin-left:5px;background-color:#e53f38;'> didn't work</b>";
}

1 个答案:

答案 0 :(得分:0)

你不需要PHP标签&amp; PHP代码中的回声

$url = 'http://<? echo $rows["p_ip"]';

应该只是

$url = 'http://'.$rows["p_ip"];