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条)

报告相同问题?

悬赏问题

  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题