For help. How can we delete page = 1111 in a = ddddd & amp; page = 1111. This is a url address. the parameter string is truncated. A = ddddd $ page = 2334 & amp; www = 2222 page = 1111 & amp; m = 3234 & amp; o = r2345a = ddddd $ wc = 2334 & a for help. How can we delete page = 1111 in a = ddddd & page = 1111.
This is a url address. the parameter string is truncated.
A = ddddd $ page = 2334 & www = 2222
Page = 1111 & m = 3234 & o = r2345
A = ddddd $ wc = 2334 & page = plo
All three methods are possible. Front, middle, and end.
How can we get rid of page = parameter values in regular expressions.
I wrote this regular expression for half a day. Page =. * & | \ s, or no match.
Give me some advice. Share:
------ Solution --------------------
$ S = 'a = ddddd & page = 2334 & www = 100 ';
$ S = 'page = 1111 & m = 3234 & o = r2345 ';
$ S = 'a = ddddd & wc = 2334 & page = PLO ';
// This is more formal
Parse_str ($ s, $ );
Unset ($ a ['Page']);
Echo http_build_query ($ a), PHP_EOL;
// Regular expressions are more alternative
Echo preg_replace ('/(&?) Page = [^ &] + (&?) /E', '"$2 "? "$1": "" ', $ s );
------ Solution --------------------
Reference:
Quote: reference:
$ S = 'a = ddddd & page = 2334 & www = 100 ';
$ S = 'page = 1111 & m = 3234 & o = r2345 ';
$ S = 'a = ddddd & wc = 2334 & page = PLO ';
// This is more formal
Parse_str ($ s, $ );
Unset ($ a ['Page']);
Echo http_build_query ($ a), PHP_EOL;
// Regular expressions are more alternative
Echo preg_replace ('/(&?) Page = [^ &] + (&?) /E', '"$2 "? "$1": "" ', $ s );
You are amazing. It's strange. How did you learn that well. I have been using php for several years, and I have to check regular expressions on Baidu. How did you learn it?
Http_build_query ($ a), PHP_EOL; this is not very common. What do you think. I can't think of it. Why. I'm not satisfied!
If you ask Baidu every time and try writing it by yourself without combining your experience and knowledge, you will never think of some amazing ideas.
$s = 'a=ddddd&page=2334&www=2222';
//$s = 'page=1111&m=3234&o=r2345';
//$s = 'a=ddddd&wc=2334&page=plo';
echo implode('&', array_filter(explode('&', $s), create_function('$str', 'return substr($str, 0, 5) !== "page=";')));