<?php class fileoperate { var $path; var $name; var $result; function creat_file($path,$name) { $filename=$path.$name; if (file_exists($filename)) { echo "文件已经存在,请换个文件名"; } else { if (file_exists($path)) { touch($name); rename($name,$filename); echo "文件建立成功 </br>"; } else{ echo "目录不存在,请检查"; } } }
Create the specified file under the specified path
* @param string $path (needs to include the file name and suffix)
* @param boolean $over_write Whether to overwrite the file
* @param int $time Set time. The default is the current system time
* @param int $atime Set the access time. The default is the current system time
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
16 Mar 2017
This article mainly introduces the file operation encapsulation class implemented in C#, and analyzes the implementation techniques related to deletion, movement, copying, renaming and other operations of C# encapsulated files in the form of complete examples. Friends in need can refer to the following
07 Jun 2018
This article mainly introduces the PHP image file operation encapsulation class. Interested friends can refer to it. I hope it will be helpful to everyone.
29 Jul 2016
: Real ZIP file operation class php: <? /******************** Author unknown Organized by: Longbill (www.longbill.cn; longbill.cn@gmail. com ) *********************/ class zip { var $datasec, $ctrl_dir = array(); var $eof_ctrl_dir = "x50x4bx05x06
25 Jul 2016
PHP's FTP operation class (copy, move, delete files, create directories)
Hot Tools
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images