dsbc80836 2015-07-25 07:12
浏览 92
已采纳

如何在php中实现请求和响应

I have URL like this, how we recive the value like "abc.org/result.php?rq=[1,2,3,4]&rq1=[5]" etc

Can any one help me to convert rq into array when recive the value in result.php

  • 写回答

3条回答 默认 最新

  • duanlei20082008 2015-07-25 07:18
    关注

    You can try using explode() & array_map()

    $rq = $_GET['rq'];
    
    $arr = array_map(function($v){ return trim($v, ' []');}, explode(',', $rq));
    
    print '<pre>';
    print_r($arr);
    print '</pre>';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?