@ApplicationPath("/v2")
它说sinatra并不知道这个小曲,我知道那是因为我没有得到请求,但是反正是在那里绕过那个?我有不同文件夹中的网站,我不想为每个文件夹路径发出get请求 这条线
@website_url = $ directory +“/”+ @instance_websites [0] +“/ index.html”
收到错误
它说试试
post '/uploadZIP' do
zipFile = params['zip'][:filename]
if zipFile.end_with? '.zip'
File.open(params['zip'][:filename], 'w') do |f|
f.write(params['zip'][:tempfile].read)
end
extract_zip(zipFile, '..\VotersBest\public')
$websites = get_websites()
redirect to('/loginTA')
end
end
#STORE WEBSITES IN ARRAY
def get_websites()
$directory = "public"
if Dir.exist? $directory
siteArray = Array.new
# go to pwd/dir
Dir.chdir($directory) { siteArray = Dir.glob("*").select {|x| Dir.exist? x }}
# go back to parent dir
siteArray
end
end
get '/websites' do
@instance_websites = $websites
@website_url = $directory+ "/"+ @instance_websites[0] + "/index.html"
erb :websites
end
但可能有时候该文件夹不称为“学生”