I'm developing a site for analyzing a store's data. I need the url part of my array to look like this:

array(
    'url'       => 'http://some.website.com:8080/SASStoredProcess/do?_username=user-123',
    '_password' => 'passwd',
    '_program'  => '/Utilisateurs/DARTIES3-2012/Mon dossier/analyse_dc',
    'annee'     => '2012',
    'ind'       => 'V',
    '_action'   => 'execute'
);

I currently have this and am struggling to convert it to the desired format:

array(
    'url' => 'url=http://some.website.com:8080/SASStoredProcess/do?_username=user-123&_password=passwd&_program=%2FUtilisateurs%2FDARTIES3-2012%2FMon+dossier%2Fanalyse_dc&annee=2012&ind=V&_action=execute',
    'otherKey' => 'otherValue'
);

Please can somebody help me to convert the URL in the second code block to look like the first code block? Thanks in advance.

有帮助吗?

解决方案

So this will extract the url in the form you want, as $url:

$myArray = array(
    'url' => 'url=http://some.website.com:8080/SASStoredProcess/do?_username=user-123&_password=passwd&_program=%2FUtilisateurs%2FDARTIES3-2012%2FMon+dossier%2Fanalyse_dc&annee=2012&ind=V&_action=execute',
    'otherKey' => 'otherValue'
);
parse_str($myArray['url']);
echo $url;

You will need to decide where it needs to go next and how you get it there.

其他提示

You might want to use: parse_url() and parse_str() over your $array['url']

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top