【发布时间】:2013-05-27 06:53:39
【问题描述】:
我必须通过我的php 脚本与Samba 服务器建立连接,以便将一些文件下载到我的本地服务器中。
其实我还是第一次听说Samba 之类的东西,所以我试图寻找可以使用的开源代码。
这是我找到的:First class - smbclient.php,我尝试了页面上发布的代码:
<?php
require_once ('smbclient.php');
$smbc = new smbclient ('//10.0.1.1/example', 'exampleuser', 'examplepassword');
if (!$smbc->get ('path/to/desired/file.txt', '/tmp/localfile.txt'))
{
print "Failed to retrieve file:\n";
print join ("\n", $smbc->get_last_stdout());
}
else
{
print "Transferred file successfully.";
}
?>
根据我的需要调整它(服务器、用户、密码),我得到的只是
Failed to retrieve file:
Fatal error: Call to undefined method smbclient::get_last_stdout()
然后我发现了 smbwebclient.php 项目,它看起来很棒,可以在 here 找到。
这个类看起来不错,但问题是我不知道如何使用它。任何人都可以发布它的示例连接或教程链接吗?
【问题讨论】: