duangai9678 2014-02-15 11:32
浏览 44
已采纳

使用php脚本代码解析错误[关闭]

i have this code and all time i get same error

error_reporting(0);
$file = basename($_FILES['uploaded']['name']).'.scan';
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $file)) {
    $myFile = "ip_up.txt";

    $fh = fopen($myFile, 'w');
    $port1 = $_POST['port3'];
    $port2 = $_POST['port4'];
    $ofile = @fopen($file, "r");

    if ($ofile) {
        while (!feof($ofile)) {
            $ip1 = fgets($ofile, 2048);
            $ip = trim($ip1);

            for($i=$port1;$i<$port2+1;$i++) {
                $tB = microtime(true);
                $fP = fSockOpen($ip, $i, $errno, $errstr, 1);
                $tA = microtime(true);
                if (!$fP) {
                    echo $ip.":".$i." – down";
                } else {
                    echo $ip.":".$i." – ".round((($tA – $tB) * 1000), 0)." ms";
                    fwrite($fh,$ip."
");
                }
                echo "<br>";
                flush();
            }
        }
    }
    echo '<a href="ip_up.txt">Download</a>';
}
else die('error');
?>

it gives me this error in line 20

Parse error: syntax error, unexpected T_STRING

i tried to put ' ' in line 20..but it dosend work !!

  • 写回答

2条回答 默认 最新

  • drsxobip501258 2014-02-15 11:38
    关注

    The problem is here:

    round((($tA – $tB)
    

    I think that you want to subtract them, so use this:

    round((($tA - $tB)
    

    It's a very minor difference, but you are not using the correct dash.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度