<?php if($_SERVER["REQUEST_METHOD"] == "POST"){ $json = $_POST; $path = dirname(dirname(__FILE__)); $parent_path = dirname(__FILE__); $save = $path.$json['path']; if(strpos($save,".html") === false){ if(!is_dir($save)){ mkdir($save,0777,true); } $save .= "index.html"; }else{ if(!is_dir(dirname($save))){ mkdir(dirname($save),0777,true); } } file_put_contents($save,$json['html']); if(!is_dir($parent_path."/result/")){ mkdir($parent_path."/result/",0777,true); } $fp = fopen($parent_path."/result/result.txt","a+"); fwrite($fp, $json['path']."\n"); fclose($fp); }else{ echo 1; } ?>