Ec (2); & nbsp; copy the code functionpoWrite ($ filename, $ data, $ methodrb +, $ iflock1, $ check1, $ chmod1) {& nbsp; & nbsp; touch ($ filename); & nbsp; script ec (2); script
| The Code is as follows: |
|
|
Function poWrite ($ filename, $ data, $ method = 'rb + ', $ iflock = 1, $ check = 1, $ chmod = 1 ){
Touch ($ filename );
$ Handle = fopen ($ filename, $ method );
$ Iflock & flock ($ handle, LOCK_EX );
If (@ fwrite ($ handle, $ data) === FALSE ){
Fclose ($ handle );
Return false;
}
$ Method = 'rb + '& ftruncate ($ handle, strlen ($ data ));
Fclose ($ handle );
$ Chmod & @ chmod ($ filename, 0777 );
Return true;
}
Function poVarExport ($ input, $ f = true, $ t = null ){
$ Output = '';
If (is_array ($ input )){
$ Output. = "array (";
Foreach ($ input as $ key => $ value ){
$ Output. = $ t. "". poVarExport ($ key, $ f, $ t. ""). '=> '. poVarExport ($ value, $ f, $ t. "");
$ Output. = ",";
}
$ Output. = $ t .')';
} Elseif (is_string ($ input )){
$ Output. = $ f? "'". Str_replace (array ("\", "'"), array ("\", "'"), $ input ). "'": "' $ input '";
} Elseif (is_int ($ input) | is_double ($ input )){
$ Output. = "'". (string) $ input ."'";
} Elseif (is_bool ($ input )){
$ Output. = $ input? 'True': 'false ';
} Else {
$ Output. = 'null ';
}
Return $ output;
} |
PoWrite (DES. "filename. php "," ");