实例 打开一个目录,读取它的内容,然后关闭: <?php$dir = "/images/";// Open a directory, and read its contentsif (is_dir($dir)){ if ($dh = opendir($dir)){ while (($file = readdir($dh)) !== false){ echo "filename:"
实例 改变根目录: <?php// Change root directory chroot("/path/to/chroot/");// Get current directory echo getcwd();?> 结果: / 定义和用法 chroot() 函数改变当前进程的根目录为 directory,并把当前工作目录改为 "/"。 注意:该函数需要 root 权限,且仅在 GNU 和 B
实例 改变当前的目录: <?php// Get current directory echo getcwd() . "<br>";// Change directory chdir("images");// Get current directory echo getcwd(); ?> 结果: /home/php/home/php/images 定义和用法 chdir() 函数
实例 返回时区数据库的版本: <?php echo timezone_version_get();?> 定义和用法 timezone_version_get() 函数返回时区数据库的版本。 语法 timezone_version_get(); 技术细节 返回值: 以字符串形式返回时区数据库的版本。 PHP 版本: 5.3+
实例 创建一个新的 DateTimeZone 对象,然后返回时区的名称: <?php $tz=timezone_open("Europe/Paris"); echo timezone_name_get($tz);?> 定义和用法 timezone_open() 创建一个新的 DateTimeZone 对象。 语法 timezone_open(timezone); 参数 描
实例 返回相对于 GMT 的时区偏移: <?php $tz=timezone_open("Asia/Taipei"); $dateTimeOslo=date_create("now",timezone_open("Europe/Oslo"));echo timezone_offset_get($tz,$dateTimeOslo);?> 定义和用法 timezone_offset_get
实例 返回时区的名称: <?php $tz=timezone_open("Europe/Paris"); echo timezone_name_get($tz);?> 定义和用法 timezone_name_get() 返回时区的名称。 语法 timezone_name_get(object); 参数 描述 object 必需。规定一个 DateTimeZ
实例 根据时区缩略语返回时区名称: <?php echo timezone_name_from_abbr("EST") . "<br>";echo timezone_name_from_abbr("",7200,0);?> 定义和用法 timezone_name_from_abbr() 根据时区缩略语返回时区名称。 语法 timezone_name_from_abbr(a
实例 返回指定时区的位置信息: <?php $tz=timezone_open("Asia/Taipei"); echo timezone_location_get($tz);?> 定义和用法 timezone_location_get() 返回指定时区的位置信息。 语法 timezone_location_get(object); 参数 描述 object
实例 输出非洲的所有时区: <?php print_r(timezone_identifiers_list(1));?> 定义和用法 timezone_identifiers_list() 返回带有所有时区标识符的数值数组。 语法 timezone_identifiers_list(what,country); 参数 描述 what 可选。规定一个 Dat