Deletion of files through functions Copy Display Whether to enable magic references
Release: 2016-07-25 09:07:04
Original
911 people have browsed it
Deletion of files through functions Copy Already displayed Whether to enable magic references
- /**
- 2012-4-12丨Yiyifan Taixi丨
- *Customized addslashes function, supports multi-dimensional arrays, supports automatic identification of whether the server has enabled magic references
- */
- function add_slashes($var){
- //First determine whether the server supports magic quotes
- if(get_magic_quotes_gpc()==0){
- if(is_array ($var)){
- //Traverse the array
- foreach($var as $key => $value){
- $var[$key] = add_slashes($value);
-
- }
- return $var;
- }
- }elseif(is_string($var)){
- //Not an array, but a string
- return addslashes($var);
- }else{
- //Already turned on
- return $var;
- }
- }
-
- //copy Function to realize the copy function of files and folders
-
- function dir_copy($src,$dst){
- if(is_dir($src)){
- if(!file_exists($dst)){
- @mkdir($dst,0777 ,true);
- }
- }
- $fp = opendir($src);
- while(!false==($fn=readdir($fp))){
- if($fn == "." || $ fn == ".."){
- continue;
- }
- $path = $src.DIRECTORY_SEPARATOR.$fn;
- if(is_dir($path)){
- dis_copy($path,($dst.DIRECTORY_SEPARATOR.$fn ));
- }elseif(is_file($path)){
- copy($path,($dst.DIRECTORY_SEPARATOR.$fn));
- }else{
- copy($path,($dst.DIRECTORY_SEPARATOR.$fn) ;
- while(!false== ($fn =readdir($fp))){
- if($fn=="." || $fn == ".."){
- continue;
- }
- $path = $src.DIRECTORY_SEPARATOR.$fn;
- if(is_dir($path)){
- delete_dir($path);
- }elseif(is_file($path)){
- @unlink($path);
- }else{
- @ unlink($path);
- }
- }
-
- }
- closedir($fp);
- @rmdir($src);
- }
-
-
- //msg output returns
-
- function msg($msg){
- echo $ msg."
";
- echo "Return to the previous page";
- die;
-
- }
-
-
-
- Copy code
-
-
-
-
-
-
-
|
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31