跑数据示例一

<?php 
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$w = isset($_GET['w']) ? intval($_GET['w']) : 0;

$arr = file('code-'.$w.'.txt');

if (!array_key_exists($id,$arr)){
    echo 'finish protein-'.$w.'-F.txt';
    $w++;
    header("location:http://127.0.0.1/20150115/a.php?w=".$w);
    exit;
}

$Conn = mysql_connect ( "localhost", "root", "root" ) or die ( "连接服务器失败 !!!" );
mysql_select_db ( "1111" ) or die ( "选择数据库失败 !!!" );


$code = preg_replace('/[
]+/','',$arr[$id]);
$sql = "select product_oldid from product where product_pid = 10 and product_code = '".$code."' 
and product_hidden = 1 and product_deleted = 0 limit 1"; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)){ $parr[] = $row; } if (!empty($parr)){ $str = "http://www.cusabio.com/protein-Recombinant_Protein-".$parr[0]['product_oldid']."/"; $str .= " "; } else { $str = " "; } mysql_close($Conn); file_put_contents('enUrl-'.$w.'.txt',$str,FILE_APPEND); ?> <script> function JumpUrl() { location.href='?id=<?php echo ($id+1);?>&w=<?php echo $w;?>'; } setTimeout('JumpUrl()',0); </script>
原文地址:https://www.cnblogs.com/wuheng1991/p/5197104.html