쿼리스트링을 배열로...

PHP 2021. 1. 8. 15:43

728x90
<?php
$qs = "https://www.google.com/search?newwindow=1&safe=off&source=hp&ei=Zv73X8LdFsv7wQP17r-oDA&q=%ED%85%8C%EC%8A%A4%ED%8A%B8+%EC%A4%91&oq=%ED%85%8C%EC%8A%A4%ED%8A%B8+%EC%A4%91&uact=5";
$parse = parse_url($qs);
parse_str($parse['query'], $result);
print_r($result);

Array
(
    [newwindow] => 1
    [safe] => off
    [source] => hp
    [ei] => Zv73X8LdFsv7wQP17r-oDA
    [q] => 테스트 중
    [oq] => 테스트 중
    [sclient] => psy-ab
    [ved] => 0ahUKEwjCqNas3YvuAhXLfXAKHXX3D8UQ4dUDCAY
    [uact] => 5
)

반응형

댓글 0