Php file operation class (create and write files) to generate logs & lt ;? Php *** file operations (log generation) support multiple inserts * (if multiple statements are inserted and line breaks are inserted, separate them with commas) ** classlog=public?path'.info.txt & #39; default file public $ mode & #39; a & #39; PHP file operation class (create a file and write it) to generate logs
Path = $ path;} // Determine the operation method. a append the write if (! Empty ($ mode) {$ this-> mode = $ mode;} // judge the written content if (! Empty ($ content) {$ this-> content = $ content;} $ handle = fopen ($ this-> path, $ this-> mode ); // split the line feed $ string = explode (",", $ this-> content); foreach ($ string as $ v) {fwrite ($ handle, $ v. "\ r \ n") ;}fclose ($ handle) ;}// use $ log = new log (); // $ log-> addlog (); // do not pass the value to the default value. // $ log-> addlog (". /log "," a "," Content 1: $ content1 content 2: $ content2 content 3: $ content3 "); // upload multiple contents // $ log-> addlog (". /log "," a "," 123,123,123 "); // Insert and wrap at a time