簡體   English   中英

cgi-bin中的變量href

[英]variable href in cgi-bin

我有一個運行某些命令和可執行文件的bash cgi腳本,最后它在一個新目錄中創建了一個結果zip文件。 這是bashcgi.sh文件代碼:

#!/bin/sh
echo "Content-type: text/html"
echo '<!DOCTYPE html>'
echo '<html lang="en">'
echo '  <head> '
echo ' <h1><a href="/test/index.html">Test</a></h1>'
echo ' </head>
echo '<body>'
**my script and variables here**
echo 'Download the output files: '
echo '<a href="/var/htdocs/test/$variableOutput/output.zip">click here to download result</a><br> '
echo '</body>
echo '</html>

上面的腳本文件位於“ / var / cgi-bin /”中,其中有許多變量,並在var / htdocs / test /中創建了一個輸出文件夾,該文件夾名稱根據用戶輸入而變化(在以前的php中,輸入名稱(將另存為文本文件)是否可以通過任何方式鏈接到href中的變量文件夾? 也就是說,當用戶單擊鏈接時,應該將他們重定向到具有變量文件夾名稱的鏈接。 例如,如果$variableOutput = testresult1 ,則應將其重定向到/var/htdocs/test/testresult1/output.zip

echo "<a href=/var/htdocs/test/$variableOutput/output.zip>click here to download result</a><br>"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM