補充說明一下,這是在執行 64 位元 Linux 作業系統的 php 5.3.5 環境下測試的....
我還沒有在其他版本上測試過。
但在 php 錯誤列表中,關於這方面的討論很多。
(PECL ssh2 >= 0.9.0)
ssh2_sftp_stat — 取得遠端檔案系統上檔案的狀態
有關可能返回的值的詳細資訊,請參閱 stat() 的說明文件。
範例 #1 透過 SFTP 取得檔案狀態
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$sftp = ssh2_sftp($connection);
$statinfo = ssh2_sftp_stat($sftp, '/path/to/file');
$filesize = $statinfo['size'];
$group = $statinfo['gid'];
$owner = $statinfo['uid'];
$atime = $statinfo['atime'];
$mtime = $statinfo['mtime'];
$mode = $statinfo['mode'];
?>
補充說明一下,這是在執行 64 位元 Linux 作業系統的 php 5.3.5 環境下測試的....
我還沒有在其他版本上測試過。
但在 php 錯誤列表中,關於這方面的討論很多。