我有一个奇怪的问题。想从带有parse_str的字符串中获取 $_GET 变量。除了第一个变量外,哪个都有效。
让我怀疑我是否正确地编写了语法。但是,是的,我想我(可能)做到了。
当我运行以下 URL 时:
system/filter/index?filter[date_selecttype]=date&filter[period_start]=08-08-2019&filter[period_end]=31-08-2019&filter[set_date]=30-08-2019&filter[booking_select_type]=booked&filter[booking_panel][6] =on&filter[booking_panel][9]=on&filter[booking_panel][1]=on&filter[booking_panel][2]=on&filter[booking_panel][11]=on&filter[booking_panel][4]=on&filter[booking_panel][5]=on&filter [booking_panel][10]=on&filter[booking_panel][7]=on&filter[booking_panel][3]=on&filter[booking_panel][12]=on&filter[booking_panel][8]=on&filter[booking_state][1]=on&filter[booking_state ][0]=on&filter[booking_state][2]=on&filter[booking_state][3]=on&filter[payment_state]=&filter[select_paymentmethod]=&filter[booking_source]=&filter[booking_saleschannel]=&filter[booking_travelcode]=&filter[booking_discountcode]=&execute_filter=1
通过以下代码:
$UrlStr = urldecode(str_replace('&', '&', __FULLURL__));
parse_str($UrlStr, $GETVariables);
我收到以下变量:
Array
(
[system/filter/index?filter] => Array
(
[date_selecttype] => date
)
[filter] => Array
(
[period_start] => 08-08-2019
[period_end] => 31-08-2019
[set_date] => 30-08-2019
[booking_select_type] => booked
[booking_panel] => Array
(
[6] => on
[9] => on
[1] => on
[2] => on
[11] => on
[4] => on
[5] => on
[10] => on
[7] => on
[3] => on
[12] => on
[8] => on
)
)
[execute_filter] => 1
)
这让我暗示我的语法不正确。 系统/过滤器/索引?过滤器
但接下来是我的问题。那怎么格式化呢?我认为这应该有效。每当我设置:index.php?filter时,结果没有任何区别。
郎朗坤