문제

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