本文整理匯總了PHP中sys::os_type方法的典型用法代碼示例。如果您正苦於以下問題:PHP sys::os_type方法的具體用法?PHP sys::os_type怎麽用?PHP sys::os_type使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sys
的用法示例。
在下文中一共展示了sys::os_type方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
function test_is_absolute_true()
{
$this->assertTrue(fs :: is_absolute('/test'));
if(sys :: os_type() == 'win32')
$this->assertTrue(fs :: is_absolute('c:/test'));
}
示例2: test_mkdir_windows
function test_mkdir_windows()
{
if (sys::os_type() != 'win32') {
return;
}
dir::mkdir(VAR_DIR . '/./tmp\\../tmp/wow////hey/', 0777, true);
$this->assertTrue(is_dir(VAR_DIR . '/tmp/wow/hey/'));
}
示例3:
function _determine_options()
{
if (sys :: os_type() == "win32")
$this->ext = '.exe';
$this->_determine_read_types();
$this->_determine_write_types();
if (sizeof($this->read_types) == 0)
$this->library_installed = false;
else
$this->library_installed = true;
}
示例4: array
function test_walk_dir()
{
$this->_create_file_system();
$mock =& new special_dir_walker($this);
$mock->expectCallCount('walk', 9+2);
if(sys :: os_type() == 'win32')
{
$mock->expectArgumentsAt(0, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_1', array('test', 'separator' => dir :: separator()), array(0)));
$mock->expectArgumentsAt(1, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_2', array('test', 'separator' => dir :: separator()), array(0, 1)));
$mock->expectArgumentsAt(2, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2)));
$mock->expectArgumentsAt(3, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'wow', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3)));
$mock->expectArgumentsAt(4, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'hey', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4)));
$mock->expectArgumentsAt(5, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_1', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5)));
$mock->expectArgumentsAt(6, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_2', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6)));
$mock->expectArgumentsAt(7, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7)));
$mock->expectArgumentsAt(8, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_1', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8)));
$mock->expectArgumentsAt(9, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_2', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)));
$mock->expectArgumentsAt(10, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)));
}
elseif(sys :: os_type() == 'unix')
{
$mock->expectArgumentsAt(0, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'wow', array('test', 'separator' => dir :: separator()), array(0)));
$mock->expectArgumentsAt(1, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'hey', array('test', 'separator' => dir :: separator()), array(0, 1)));
$mock->expectArgumentsAt(2, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_1', array('test', 'separator' => dir :: separator()), array(0, 1, 2)));
$mock->expectArgumentsAt(3, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_2', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3)));
$mock->expectArgumentsAt(4, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey'), 'test3_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4)));
$mock->expectArgumentsAt(5, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_1', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5)));
$mock->expectArgumentsAt(6, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_2', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6)));
$mock->expectArgumentsAt(7, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow'), 'test2_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7)));
$mock->expectArgumentsAt(8, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_1', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8)));
$mock->expectArgumentsAt(9, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_2', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)));
$mock->expectArgumentsAt(10, 'walk', array(dir :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp'), 'test1_3', array('test', 'separator' => dir :: separator()), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)));
}
$this->assertEqual(
dir :: walk_dir(TEST_DIR_ABSOLUTE_PATH . '/tmp/', array(&$mock, 'walk'), array('test')),
array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
);
$mock->tally();
$this->_remove_file_system();
}
示例5:
function _has_win32_net_prefix($path)
{
if(sys :: os_type() == 'win32' && strlen($path) > 2)
{
return (substr($path, 0, 2) == WIN32_NET_PREFIX);
}
return false;
}
示例6:
function is_mac()
{
return sys :: os_type() == 'mac';
}