0

How can I get string values from URL and save them as array, right now URL looks like this somename[]=xxxxxxxxx&somename[]=zzzzzzzzz&somename[]=zsdasd

$jinput = JFactory::getApplication()->input;
$nameArray = $jinput->get('somename');

If I var_dump $nameArray I get this Array and I var_dump $jinput I get this:

[data:protected] => Array
    (
        [somename] => Array
            (
            [0] => xxxxxxxxx
            [1] => zzzzzzzzz
            [2] => zsdasd
        )

    [option] => com_content
    [view] => featured
    [Itemid] => 101
)

I want to echo $nameArray like $nameArray[0] and get results "xxxxxxxxxx" but now i get Array instead.

4

1 回答 1

1

试试这样的,

$somename = JRequest::getVar('somename',array(),'', 'ARRAY');

echo "<pre/>";
print_r($somename);

希望它有帮助..

于 2013-10-18T03:21:53.333 回答