changedir() public method

The second parameter lets us momentarily turn off debugging so that this function can be used to test for the existence of a folder without throwing an error. There's no FTP equivalent to is_dir() so we do it by trying to change to a particular directory. Internally, this parameter is only used by the "mirror" function below.
public changedir ( string $path, boolean $suppress_debug = FALSE ) : boolean
$path string
$suppress_debug boolean
return boolean
示例#1
0
文件: index.php 项目: denghongbo/2015
//将处理好的文件列表备份。
for ($b = 0; $b < count($filelist); $b++) {
    $example->add_log($filelist[$b] . "\n", 'backuplist.config');
}
$filecount = count($filelist);
echo "<br/>filecount:" . $filecount . "<br/>";
//处理列表惟一标识
//连接到远程服务器,同步列表
#	$example =  new CI_FTP();
if (!$example->connect($config)) {
    die("connecting faild!");
} else {
    echo "连接成功,请等待...<br/>";
    echo "主机名:www.example.com<br/>";
    //切换到远程项目目录.
    if (!$example->changedir('public_html/example')) {
    }
    //	exit("ERROR: can not chang to $example->hostname example directory!");
    //example , exampleadmin 目录检查
    //$list = $example->list_files();
    //var_dump($list);
    //本地文件检查
    //$localfilepath = '../example';
    for ($i = 0; $i < count($filelist); $i++) {
        if (!file_exists('../example/' . $filelist[$i])) {
            $logmessage = "NOTEXIST: 文件 " . $filelist[$i] . " 不存在。\n<br/>";
            echo $logmessage;
            $example->add_log($logmessage);
            unset($filelist[$i]);
            if (count($filelist)) {
                exit("WARING: 没有上传任何文件!");