php - APACHE mod_rewrite change variable name in query string -
I am trying to change a variable name in a query string, so it is usable by my PHP code.
The query gets a post from the external system, so I can not control that it is posting a variable name with one location in it. And it makes it impossible for me to use the PHP Change me from and I need to convert variable 2 to new 2 Many variables have been passed in the query, but only these two need to be changed . need to end as ? New1 = abc and new2 = xyz In addition, they will not be in this order and can be more variable then? Variable% 20name = abc & blah = 123 & amp; Blah2 = 456 & amp; Variable 2 = xyz or Will be cured in any way! Please pars me the query mod_rewrite The string with The complete query string can be found in the You can divide it by using using the $ _ GET function.
variable% 20name to
? New1
? Variable% 20name = abc and variable2 = xyz
? New1 = abc and new2 = xyz
? May end as new1 = abc & blah = 123 & amp; Blah2 = 456 & amp; New2 = xyz
mod_rewrite is a bit of a pain, it should be done with
RewriteCond and later
RewriteRule , possibly in the original query string in PHP It's easy to break manually.
$ _ SERVE (within PHP) ['QUERY_STRING'] .
preg_split () or
explosion () , before
& amp; , then on
= , to get the key / value added.
custom% 20cbid = 123 & amp; Blahblahblah & amp; Name = example as an example.
$ params = array (); Foreign currency ($ cKey, $ cValue) = (explosion "(& amp;", $ _SERVER ['QUERY_STRING']) as $ cKeyValue) = explosion ('=', $ cKeyValue, 2); $ Paramaz [urlcode ($ cK)] = urdxide ($ c value); } // will result in: $ params = array ('custom cbid' => 123, 'blahblahblah' = & gt; NULL, 'name' => Example);
Comments
Post a Comment