0

我有两个服务器。我在 url ssid(36)、rawstring(1024)、sample_id、user_id 中传递 4 个变量。我只是想获取在 url 中传递的参数。当我访问我的第一台服务器时,我得到了参数,但是相同的 url(仅更改服务器名称),我得到了 3 个参数(没有获取原始字符串)。在我的控制器中,我正在这样测试

    echo "<pre>";
    print_r($_REQUEST);
    echo "</pre>";
    echo $_REQUEST['rawstring'];die();

这是我想要的输出

    Array
    (
    [ssid] => d41d8cd98f00b204e9800998ecf8427e
    [rawstring] => 303330363036422031333235353030323039ffffffffffffffffffffffffffff33333030302041202046542031333238203030303030323831ffffffffffffff31362f30372f323031332d2d313035343031ffffffffffffffffffffffffffff0ba504d203430aeeffffffffffffffff00db00db02ca00db02caffffffffffff00000000ffffffffffffffffffffffffbe51ffffffffffffffffffffffffffff8000ffffffffffffffffffffffffffff00ec856cffffffffffffffffffffffff2ea495a82eaa959dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff30303031303030350000000900000bbf0013ac9e0013aca300003504fffffffb06b706ae06aa06a2069c06990690068e0000086a00000ad80013acc60013acc70013acc90013accd000034f7fffffffb06b206ae06a806a1069f0697068e068a0000086f00000ac6000000020013acd7000000000000000000000000000008c400000000000000000000000000000773ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2e656e64
  [readerid] => admin
  [sample_id] => 1111
)

但我得到了这个

    Array
    (
    [ssid] => d41d8cd98f00b204e9800998ecf8427e
     [readerid] => admin
  [sample_id] => 1111
)

我已经经历了这个。但我不认为它对我有用。我也看过 htaccess 文件。它很好。我的网址就像

 <server_name>/Nfc/test/fromXML?ssid=d41d8cd98f00b204e9800998ecf8427e&rawstring=303330363036422031333235353030323039ffffffffffffffffffffffffffff33333030302041202046542031333238203030303030323831ffffffffffffff31362f30372f323031332d2d313035343031ffffffffffffffffffffffffffff0ba504d203430aeeffffffffffffffff00db00db02ca00db02caffffffffffff00000000ffffffffffffffffffffffffbe51ffffffffffffffffffffffffffff8000ffffffffffffffffffffffffffff00ec856cffffffffffffffffffffffff2ea495a82eaa959dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff30303031303030350000000900000bbf0013ac9e0013aca300003504fffffffb06b706ae06aa06a2069c06990690068e0000086a00000ad80013acc60013acc70013acc90013accd000034f7fffffffb06b206ae06a806a1069f0697068e068a0000086f00000ac6000000020013acd7000000000000000000000000000008c400000000000000000000000000000773ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2e656e64&readerid=admin&sample_id=1111

我正在使用zend。请有人帮助我。

4

1 回答 1

0

好吧,我找到了这个解决方案

   if(@$_REQUEST['rawstring']=='' || !(@$_REQUEST['rawstring'])){

        $str=($_SERVER['QUERY_STRING']);
        // print_r(parse_str($str));
        $new=explode("&rawstring=",$str);
        $raw=explode("&readerid",$new[1]);
        $_REQUEST['rawstring']=$raw[0];

    }

有没有更好的方法来解析 $_SERVER['QUERY_STRING']?

于 2013-11-04T13:04:46.903 回答