public function ftp_test($urlInfo) { AiFtp::test(); }
/** * 本类的测试方法 */ public static function test() { //$ftp = new AiFtp('192.168.1.148', 'fkb', 'fkb', 21, 'utf-8', 'gbk', 'gbk', 90); //$ftp = new AiFtp('192.168.1.148', 'fkb', 'fkb'); //$ftp = new AiFtp('192.168.1.148'); $ftp = new AiFtp(array('host' => '192.168.0.111', 'port' => 21, 'user' => 'qqqq', 'pswd' => 'qqqq', 'localCharset' => 'utf-8', 'remoteCharset' => 'gbk', 'fsCharset' => 'gbk', 'timeout' => 90)); $ftp->connect() or die('Could not connect the ftp server!'); echo "<br>=======列表测试=======<br>"; $buff = $ftp->listDirsAndFiles('/共享区/软件资源/'); if (AiFtpStatus::LIST_REMOTE_ENCODE_ERROR_ELSE === $buff) { echo "获取列表失败,可能原因是目录不存在、编码设置错误,或其它原因"; } else { var_dump($buff); } echo "<br>=======上传测试=======<br>"; //var_dump($ftp->uploadNewFile('/上传区/第三关第六关.txt', 'core/lib/ext/ftp/AiFtp.class.php'));; var_dump($ftp->uploadFile('/上传区/第三关第六关.txt', 'core/lib/ext/ftp/AiFtp.class.php')); echo "<br>=======下载测试=======<br>"; var_dump($ftp->downloadFile('res/ftp_test/J2EE.chm', '/上传区/J2EE.chm')); echo "<br>=======更名测试=======<br>"; // var_dump($ftp->rename('/Xlight实验区/abc', 'abc.xml/')); // var_dump($ftp->rename('/Xlight实验区/菜单布局及内容布置.txt', 'f**k.ttxt')); var_dump($ftp->rename('/Xlight实验区/abc/交易首页.rp', '王尼玛.sb')); $ftp->close(); }