本文整理汇总了PHP中Sys::isWin方法的典型用法代码示例。如果您正苦于以下问题:PHP Sys::isWin方法的具体用法?PHP Sys::isWin怎么用?PHP Sys::isWin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sys
的用法示例。
在下文中一共展示了Sys::isWin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setPerms
/**
* @param string $filename
* @param bool $isFlag
* @param int $perm
* @return bool
*/
protected static function _setPerms($filename, $isFlag, $perm)
{
$stat = @stat($filename);
if ($stat === false) {
return false;
}
// We're on Windows
if (Sys::isWin()) {
//@codeCoverageIgnoreStart
return true;
//@codeCoverageIgnoreEnd
}
list($myuid, $mygid) = array(posix_geteuid(), posix_getgid());
$isMyUid = $stat['uid'] == $myuid;
$isMyGid = $stat['gid'] == $mygid;
//@codeCoverageIgnoreStart
if ($isFlag) {
// Set only the user writable bit (file is owned by us)
if ($isMyUid) {
return chmod($filename, fileperms($filename) | intval('0' . $perm . '00', 8));
}
// Set only the group writable bit (file group is the same as us)
if ($isMyGid) {
return chmod($filename, fileperms($filename) | intval('0' . $perm . $perm . '0', 8));
}
// Set the world writable bit (file isn't owned or grouped by us)
return chmod($filename, fileperms($filename) | intval('0' . $perm . $perm . $perm, 8));
} else {
// Set only the user writable bit (file is owned by us)
if ($isMyUid) {
$add = intval('0' . $perm . $perm . $perm, 8);
return self::_chmod($filename, $perm, $add);
}
// Set only the group writable bit (file group is the same as us)
if ($isMyGid) {
$add = intval('00' . $perm . $perm, 8);
return self::_chmod($filename, $perm, $add);
}
// Set the world writable bit (file isn't owned or grouped by us)
$add = intval('000' . $perm, 8);
return self::_chmod($filename, $perm, $add);
}
//@codeCoverageIgnoreEnd
}