当我添加这个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>";
}
答案 0 :(得分:0)
你不需要PHP标签&amp; PHP代码中的回声
$url = 'http://<? echo $rows["p_ip"]';
应该只是
$url = 'http://'.$rows["p_ip"];