如何解析和回显CGI查询字符串参数? [英] How can I parse and echo CGI query string parameters?
问题描述
我想通过使用URL中的系统请求参数在服务器上执行命令.我正在运行服务器.
I would like to execute a command on the server by using the system request parameters in the URL. I am running the server.
在浏览器中->> //localhost:9009/?comd
,该代码将显示我在代码中放置的目录中的文件列表
In the browser ->> //localhost:9009/?comd
which is displaying the list of files in the directory as i placed in the code
if (/comd/i ) { print $client `dir`; }
如何解析请求参数?例如:
How I can parse the request parameters? For example:
http://localhost:9009/?comd & user =kkc& mail=kkc@kkc.com
http://localhost:9009/?comd&user=kkc&mail=kkc@kkc.com
我想返回->> 您好用户,请确认您的电子邮件 kkc@kkc.com
I would like to return -->> hello user please confirm your email kkc@kkc.com
如何解析网址中的请求参数?
How can I parse the request parameters in the url?
推荐答案
use CGI;
my $cgi = CGI->new();
my $user = $cgi->param( "user" );
my $mail = $cgi->param( "mail" );
print( "Hello $user please confirm your email $mail\n" );
这篇关于如何解析和回显CGI查询字符串参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!