DonKihot
01.06.2010, 09:50
Есть метод (функция) ?
public function GetFilePerm($f_name)
{
$this->perms = fileperms($f_name);
if (($this->perms & 0xC000) == 0xC000) {$this->info = 's'; /*socket*/ }
elseif (($this->perms & 0xA000) == 0xA000) {$this->info = 'l'; /*Symboliy link*/}
elseif (($this->perms & 0x8000) == 0x8000) {$this->info = '-'; /*Normal*/ }
elseif (($this->perms & 0x6000) == 0x6000) {$this->info = 'b'; /*Special block*/}
elseif (($this->perms & 0x4000) == 0x4000) {$this->info = 'd'; /*directory */}
elseif (($this->perms & 0x2000) == 0x2000) {$this->info = 'c'; /*Special symbol*/}
elseif (($this->perms & 0x1000) == 0x1000) {$this->info = 'p'; /* FIFO*/}
else {$this->info = 'u'; /* unknow */}
// user
$this->info .= (($this->perms & 0x0100) ? 'r' : '-');
$this->info .= (($this->perms & 0x0080) ? 'w' : '-');
$this->info .= (($this->perms & 0x0040) ?
(($this->perms & 0x0800) ? 's' : 'x' ) :
(($this->perms & 0x0800) ? 'S' : '-'));
// group
$this->info .= (($this->perms & 0x0020) ? 'r' : '-');
$this->info .= (($this->perms & 0x0010) ? 'w' : '-');
$this->info .= (($perms & 0x0008) ?
(($this->perms & 0x0400) ? 's' : 'x' ):
(($this->perms & 0x0400) ? 'S' : '-'));
// world
$this->info .= (($this->perms & 0x0004) ? 'r' : '-');
$this->info .= (($this->perms & 0x0002) ? 'w' : '-');
$this->info .= (($this->perms & 0x0001) ?
(($this->perms & 0x0200) ? 't' : 'x' ):
(($this->perms & 0x0200) ? 'T' : '-'));
return $this->info;
}
Вызываю так :
echo GetFilePerm($this->f_name)
Выдает : Fatal error: Call to undefined function GetFilePerm() in ...........
Но если поместить этот код в функцию и разместить его в простом коде (не в ООП классе), то все работает..
Получается что то с синтаксисом не в порядке?
public function GetFilePerm($f_name)
{
$this->perms = fileperms($f_name);
if (($this->perms & 0xC000) == 0xC000) {$this->info = 's'; /*socket*/ }
elseif (($this->perms & 0xA000) == 0xA000) {$this->info = 'l'; /*Symboliy link*/}
elseif (($this->perms & 0x8000) == 0x8000) {$this->info = '-'; /*Normal*/ }
elseif (($this->perms & 0x6000) == 0x6000) {$this->info = 'b'; /*Special block*/}
elseif (($this->perms & 0x4000) == 0x4000) {$this->info = 'd'; /*directory */}
elseif (($this->perms & 0x2000) == 0x2000) {$this->info = 'c'; /*Special symbol*/}
elseif (($this->perms & 0x1000) == 0x1000) {$this->info = 'p'; /* FIFO*/}
else {$this->info = 'u'; /* unknow */}
// user
$this->info .= (($this->perms & 0x0100) ? 'r' : '-');
$this->info .= (($this->perms & 0x0080) ? 'w' : '-');
$this->info .= (($this->perms & 0x0040) ?
(($this->perms & 0x0800) ? 's' : 'x' ) :
(($this->perms & 0x0800) ? 'S' : '-'));
// group
$this->info .= (($this->perms & 0x0020) ? 'r' : '-');
$this->info .= (($this->perms & 0x0010) ? 'w' : '-');
$this->info .= (($perms & 0x0008) ?
(($this->perms & 0x0400) ? 's' : 'x' ):
(($this->perms & 0x0400) ? 'S' : '-'));
// world
$this->info .= (($this->perms & 0x0004) ? 'r' : '-');
$this->info .= (($this->perms & 0x0002) ? 'w' : '-');
$this->info .= (($this->perms & 0x0001) ?
(($this->perms & 0x0200) ? 't' : 'x' ):
(($this->perms & 0x0200) ? 'T' : '-'));
return $this->info;
}
Вызываю так :
echo GetFilePerm($this->f_name)
Выдает : Fatal error: Call to undefined function GetFilePerm() in ...........
Но если поместить этот код в функцию и разместить его в простом коде (не в ООП классе), то все работает..
Получается что то с синтаксисом не в порядке?