One, configure config file
1 Gets an array of config.php files,
2 Get the value of form form submission
3 Save the Update config.php file with the following code:
1 $color=$_post[' Color '];2 $backtype=$_post[' Backtype '];3 4 $settings=include(dirname(__dir__). ' /config.php ');5 6 $settings[' Themescolor ']= (int)$color;7 $settings[' Themesbackground ']= (int)$backtype;8 9 //Open Output BuffersTen Ob_start(); One A //returns the PHP code generated by the array - Var_export($settings); - the //returns the contents of the internal buffer - $arrStr=ob_get_contents(); - - //Delete the contents of the internal buffer and close the internal buffer + Ob_end_clean(); - + $config= ' <?php '.Php_eol A. ' Return '.$arrStr.‘;‘; at - //writes a string to the configuration file. - file_put_contents(dirname(__dir__). ' /config.php ',$config);
The config.php file is as follows:
<?phpreturn Array ( ' themescolor ' = 3, ' themesbackground ' = 3,);
Second, form upload file
The code is as follows:
if((($_files["Path"] ["type"] = = "Image/gif") | | ($_files["Path"] ["type"] = = "Image/jpeg") | | ($_files["Path"] ["type"] = = "Image/png")) && ($_files["Path"] ["Size"] < 500000)) { if($_files["Path"] ["error"] > 0) { Echo"Return Code:".$_files["Path"] ["Error"] ; } Else { if(!file_exists($PATHHD)){//determine if the Save directory exists mkdir($PATHHD, 0777,true);//Create a Save directory } $tool->deleteall ($PATHHD);//Clear the Head folder//move the uploaded file to a new location. Move_uploaded_file($_files["Path"] ["Tmp_name"],$PATHHD.‘ /‘.$_files["Path"] ["Name"]); } } Else{echo "Invalid file";
}
PHP Daemon Configuration config file, and form form upload file