- 论坛徽章:
- 0
|
怀着无比期待的心情再问一个问题
json需要用双引号的。
如果我有个数组里面含有变量。如何处理??
#!c:/perl/bin/perl.exe
## modules json test
use CGI;
use strict;
use warnings;
# read the CGI params
my $cgi = CGI->new;
my $username = $cgi->param("username");
my $password = $cgi->param("password");
my $username = "myname";
# create a JSON string according to the database result
### ok version of jason format for sample login
my $json =q({"success" :"login is successful","userid":"$username", "passwordtest":"中国sssssxxxss" });
print $cgi->header( 'application/json' );
print $json;
目前不用双引号就出错。用了双引号。变量值就无法获得。
请问该怎么处理。 翻遍坛子好像对json的讨论好少。几乎没资料可参照。
希望 有人能帮我一下。
谢谢 |
|