//保存文件 //$_SERVER['DOCUMENT_ROOT']="D:/www/" //$_SERVER["SCRIPT_NAME"]="/项目名/index.php" $www_path=$_SERVER['DOCUMENT_ROOT']; $save_path=explode("/",$_SERVER["SCRIPT_NAME"])[1]; $fp=fopen($www_path.$save_path."/public/data/SalesDay.json","w+"); fwrite($fp,json_encode($result)); fclose($fp);