In the normal development of Web sites, we have to deal with URLs, we can access specific addresses through a URL, we can pass the URL we need to test parameters, so how to get the parameters in the URL becomes important. This blog post will be how to get the parameters in the URL, this is just a function method, by passing the complete URL address string to get the parameters, the following is the code:
<?php /** * ======================================= * Created by Zhihua_w. * Author:zhihua_w * DATE:2017/1/3 0009 * Time: Morning 11:03 * project:php Development Tips * Power: Get each parameter in the URL * = ====================================== */ /** * Get each parameter in the URL * similar to PAY_CODE=ALIPAY&BANK_ Code=icbc-debit * @param type $str * @return Type * /function Parse_url_param ($str) { $data = Array (); $parameter = Explode (' & ', End (explode ('? ', $str))); foreach ($parameter as $val) { $tmp = explode (' = ', $val); $data [$tmp [0]] = $tmp [1]; } return $data; } ? >