Внешний интерфейс
//accept restricts the type of upload
Бэкенд-запись: (скачать. php)
$data = var_export ($_FILES, true); // Receive FormData Define ('UPLOAD_DIR','. / Resources/skill/'); // Set up your download directory here FileName = UPLOAD_DIR. $a.'. gif'; // This can be another file type, but the front-end accept will also change. $success = file_put_contents ($fileName, $data); // Upload files here need to pass two parameters, one is file path + file and the other is FormData we received from the front end. $data=array(); if($success){ $data['status']=$fileName; $data ['msg']='successful upload'; echo json_encode($data); }else{ $data['status']=0; Data ['msg']='The system is busy, please try again after sale'; echo json_encode($data); } // The last thing to return is the JSON format
Ключевой функцией PHP здесь является функция file_put_contents (), которая записывает строку в файл.
Если в вышесказанном есть что-то неправильное, вы можете указать на это.
Если эта статья вам полезна, вы можете сделать комплимент или забрать ее в качестве поощрения автору.~
Прилагается веб-сайт моего младшего брата. Www.entercode.cn способствует возникновению волны…