it mainly first obtains the path of the current directory, and then determines whether the folder exists. if it does not exist, create it.
define('DIR_ROOT', str_replace('\\','/',dirname(__FILE__)));//获取当前文件物理路径 $tmp_file_path = DIR_ROOT.'/tmp/';//在根目录下增加tmp目录的路径 if(is_dir($tmp_file_path)) echo "tmp文件夹存在!"; else { mkdir($tmp_file_path, 0700);//如果不存在tmp目录,则建立 echo "tmp文件夹不存在,尝试建立成功! ";//未检测建立是否成功 echo "tmp目录为".$tmp_file_path; } ?>