PHP code to replace parameter variables in URL

WBOY
Release: 2016-07-25 09:04:21
Original
835 people have browsed it
  1. /**
  2. * Set a certain parameter in the URL to a certain value
  3. * link: bbs.it-home.org
  4. * date: 2013/2/27
  5. */
  6. function url_set_value($url,$key,$value)
  7. {
  8. $a=explode('?',$url);
  9. $url_f=$a[0];
  10. $query=$a[1];
  11. parse_str($query,$arr);
  12. $arr[$key]=$value;
  13. return $url_f.'?'.http_build_query($arr);
  14. }
  15. ?>
复制代码


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!