网址参数不正确

时间:2013-11-04 12:08:28

标签: php url zend-framework

我有两台服务器。我在url ssid(36),rawstring(1024),sample_id,user_id中传递了4个变量。 我简单地想要在url中传递参数。当我点击我的第一台服务器时我得到了param,但是同样的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
)

我已经通过了this。但我认为它不适合我。我也看过htaccess文件。没关系。 我的网址就像

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

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

1 个答案:

答案 0 :(得分: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']?