このURIを置き換えたい
http://localhost/prixou/index.php?page=list&category=1&sub=1&subsub=0&brand=Sony&toto=titi
このURIによって
http://localhost/prixou/index.php?page=list&category=1&sub=1&subsub=0&kljklj=sdfsd
==>「&brand=Sony」を削除したい
私はこれを試しました:
preg_replace('/(^.*)(&brand=.*)(&.*)/', '$1$3', 'http://localhost/prixou/index.php?page=list&category=1&sub=1&subsub=0&brand=Sony&toto=titi');
ただし、特定の場合には機能しません。URIにパラメータ「toto」が存在しない場合
だから私がそうするなら
preg_replace('/(^.*)(&brand=.*)(&.*)/', '$1$3', 'http://localhost/prixou/index.php?page=list&category=1&sub=1&subsub=0&brand=Sony');
動作しません==>「&brand=Sony」は引き続き表示されます
では、どうすればよいですか?