xxxx日本护士丰满hd|亚洲av日韩av无码av欧美av|精品国产污污网站在线看免费|日日摸日日碰夜夜爽久久|国产一区二区亚洲精品

touch

(PHP 4, PHP 5, PHP 7, PHP 8)

touch設定文件的訪(fǎng)問(wèn)和修改時(shí)間

說(shuō)明

touch(
    string $filename,
    int $time = time(),
    int $atime = ?,
    ?int $mtime = null,
    ?int $atime = null
): bool

嘗試將由 filename 給出的文件的訪(fǎng)問(wèn)和修改時(shí)間設定為給出的 mtime。 注意訪(fǎng)問(wèn)時(shí)間總是會(huì )被修改的,不論有幾個(gè)參數。

如果文件不存在,則會(huì )被創(chuàng )建。

參數

filename

要設定的文件名。

mtime

要設定的時(shí)間。如果參數 mtimenull,則會(huì )使用當前系統的 time()。

atime

如果這個(gè)參數不是 null,則給定文件的訪(fǎng)問(wèn)時(shí)間會(huì )被設為 atime。 否則會(huì )設置為 mtime。 如果兩個(gè)參數都是 null,則使用當前系統時(shí)間。

更新日志

版本 說(shuō)明
8.0.0 mtimeatime 現在可以為空。

返回值

成功時(shí)返回 true, 或者在失敗時(shí)返回 false。

范例

示例 #1 touch() 例子

<?php
if (touch($filename)) {
    echo 
$filename ' modification time has been changed to present time';
} else {
    echo 
'Sorry, could not change modification time of ' $filename;
}
?>

示例 #2 使用 mtime 參數的 touch()

<?php
// This is the touch time, we'll set it to one hour in the past.
$time time() - 3600;

// Touch the file
if (!touch('some_file.txt'$time)) {
    echo 
'Whoops, something went wrong...';
} else {
    echo 
'Touched file with success';
}
?>

注釋

注意:

注意:不同文件系統對時(shí)間的判斷方法可能是不相同的。

xxxx日本护士丰满hd|亚洲av日韩av无码av欧美av|精品国产污污网站在线看免费|日日摸日日碰夜夜爽久久|国产一区二区亚洲精品