Get last 15 lines from a large file in SFTP with phpseclib [duplicate]
问题 This question already has answers here : How do you get last some lines of file via SFTP in PHP (3 answers) Closed 11 months ago . I want to get the last 15 lines from a large file (30MB) from a SFTP server using PHP. I tried using the phpseclib's SFTP functionality like that: include('./Net/SFTP.php'); $sftp = new Net_SFTP("server", 2022); if (!$sftp->login('username', 'password')) { exit("Login error"); } $size = $sftp->size('./file.txt'); $Container = nl2br($sftp->get('./file.txt', false,