date = '20190722'; $app->login(); $app->hasFile(); $app->start(); dump($app->msg); die(); $path = '/home/wwwroot/pingan/upload/'; $name = 'JYMX66007320190722.txt'; $adapter = new SftpAdapter([ 'host' => '123.57.16.212', 'port' => 22, 'username' => 'root', 'password' => 'Anetadmin1', 'privateKey' => '', 'passphrase' => '', 'root' => $path, 'timeout' => 10, 'directoryPerm' => 0755, ]); $filesystem = new Filesystem($adapter); $lists = $filesystem->listContents(); $content = $filesystem->read($name); $content = str_replace("\n", "br", $content); dump($content); $content = explode("br", $content); foreach ($content as $item) { $array = explode('|', $item); foreach ($array as $item) { echo $item . "
"; } echo '----------------------------------------' . "
"; } dd($content); } public function index(Request $request) { if (method_exists($this, $request->action)) { return call_user_func_array([$this, $request->action], [$request->all()]); } else { dd('未找到方法'); } } }