位置: 编程技术 - 正文
推荐整理分享PHP:touch()的用法_Filesystem函数(php trim()),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:php touch,php trim(),php trim(),php use function,php throwable,php true,php true,php true,内容如对您有帮助,希望把文章链接给更多的朋友!
(PHP 4, PHP 5)
touch — 设定文件的访问和修改时间
说明 bool touch ( string $filename [, int $time = time() [, int $atime ]] )尝试将由 filename 给出的文件的访问和修改时间设定为给出的 time。 注意访问时间总是会被修改的,不论有几个参数。
如果文件不存在,则会被创建。
参数filename
要设定的文件名。
time要设定的时间。如果没有提供参数 time 则会使用当前系统的时间。
atime如果给出了这个参数,则给定文件的访问时间会被设为 atime,否则会设置 为time。如果没有给出这两个参数,则使用当前系统时间。
返回值成功时返回 TRUE, 或者在失败时返回 FALSE。
更新日志版本 说明 5.3.0 能够修改 Windows 下目录的最后修改时间。
范例
Example #1 touch() 例子
<?phpif(touch($filename)){echo$filename.'modificationtimehasbeenchangedtopresenttime';}else{echo'Sorry,couldnotchangemodificationtimeof'.$filename;}?>
Example #2 使用 time 参数的 touch()
<?php//Thisisthetouchtime,we'llsetittoonehourinthepast.$time=time()-;//Touchthefileif(!touch('some_file.txt',$time)){echo'Whoops,somethingwentwrong...';}else{echo'Touchedfilewithsuccess';}?> 注释Note:
注意:不同文件系统对时间的判断方法可能是不相同的。
Warning在 PHP 5.3.0 之前无法修改 Windows 下目录的最后修改时间。
PHP:umask()的用法_Filesystem函数 umask(PHP4,PHP5)umask改变当前的umask说明intumask([int$mask])umask()将PHP的umask设定为mask并返回原来的umask。当PHP被作为服务器模块使用时,在每个请求结束后uma
PHP:tempnam()的用法_Filesystem函数 tempnam(PHP4,PHP5)tempnam建立一个具有唯一文件名的文件说明stringtempnam(string$dir,string$prefix)在指定目录中建立一个具有唯一文件名的文件。如果该目录不存在
PHP:tmpfile()的用法_Filesystem函数 tmpfile(PHP4,PHP5)tmpfile建立一个临时文件说明resourcetmpfile(void)以读写(w+)模式建立一个具有唯一文件名的临时文件,返回一个文件句柄。文件会在关闭后
标签: php trim()
本文链接地址:https://www.jiuchutong.com/biancheng/285167.html 转载请保留说明!上一篇:PHP:unlink()的用法_Filesystem函数(php中link什么意思)
下一篇:PHP:umask()的用法_Filesystem函数(php umask)
友情链接: 武汉网站建设