yeahz Posted August 29, 2010 Report Share Posted August 29, 2010 ?type=desc&country=142&pager=2 Kā lai nogriež to &pager=2 ? Quote Link to comment Share on other sites More sharing options...
mickys Posted August 29, 2010 Report Share Posted August 29, 2010 http://php.net/manual/en/function.substr.php Example #2 Using a negative length Quote Link to comment Share on other sites More sharing options...
briedis Posted August 29, 2010 Report Share Posted August 29, 2010 echo substr("?type=desc&country=142&pager=2", 0, 22); derēs? Vai varbūt precizēsi, vispārīgāk, ko tieši gribi panākt? Izmest vienu get parametru no linka? Vari explodēt ar "&", tad ar "=", pārrakstot tikai vajadzīgos parametrus. Vispār man liekas, tev jāmeklē nevis risinājums šai problēmai, bet cēlonis. Kādēļ rodas šāds gadījums, kā jāgriež daļa no linka? Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted August 29, 2010 Report Share Posted August 29, 2010 http://uk3.php.net/parse_str Quote Link to comment Share on other sites More sharing options...
Kaitnieks Posted August 29, 2010 Report Share Posted August 29, 2010 $s = preg_replace('/&pager=[0-9]*/', '', $s); Quote Link to comment Share on other sites More sharing options...
Kverkagambo Posted August 29, 2010 Report Share Posted August 29, 2010 unset($_GET['pager']); Quote Link to comment Share on other sites More sharing options...
yeahz Posted August 29, 2010 Author Report Share Posted August 29, 2010 Paldies par funkcijām, bet kāpēc šādā gadījumā izmet erroru (nomainīju & pret ?)? $s = preg_replace("/?pager=[0-9]*/", '', $_SERVER['REQUEST_URI']); => Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 in ... on line 68 Quote Link to comment Share on other sites More sharing options...
yeahz Posted August 29, 2010 Author Report Share Posted August 29, 2010 Vispār man liekas, tev jāmeklē nevis risinājums šai problēmai, bet cēlonis. Kādēļ rodas šāds gadījums, kā jāgriež daļa no linka? Jo kad pārslēdz nākošo lapu, tad tas &pager=8 pielīp vēlvienu reizi un tā veidojas arvien vairāk viņi ?type=desc&country=142&pager=2 ?type=desc&country=142&pager=2&pager=3 ?type=desc&country=142&pager=2&pager=3&pager=4 Quote Link to comment Share on other sites More sharing options...
Kaitnieks Posted August 29, 2010 Report Share Posted August 29, 2010 Paldies par funkcijām, bet kāpēc šādā gadījumā izmet erroru (nomainīju & pret ?)? Jautājuma zīmes regeksos ir jāizbēdzina (?) $s = preg_replace("/\\?pager=[0-9]*/", '', $_SERVER['REQUEST_URI']); Quote Link to comment Share on other sites More sharing options...
yeahz Posted August 29, 2010 Author Report Share Posted August 29, 2010 paldies Quote Link to comment Share on other sites More sharing options...
briedis Posted August 29, 2010 Report Share Posted August 29, 2010 Jo kad pārslēdz nākošo lapu, tad tas &pager=8 pielīp vēlvienu reizi un tā veidojas arvien vairāk viņi ?type=desc&country=142&pager=2 ?type=desc&country=142&pager=2&pager=3 ?type=desc&country=142&pager=2&pager=3&pager=4 Vai tad nevar izlabot, lai tā nebūtu? Quote Link to comment Share on other sites More sharing options...
Леший Posted August 30, 2010 Report Share Posted August 30, 2010 (edited) Briedi, manliekas, viņš to arī meģina izdarīt. Edited August 30, 2010 by Леший Quote Link to comment Share on other sites More sharing options...
marcis Posted August 30, 2010 Report Share Posted August 30, 2010 Tak taisi vienkārši: $url = '?'.http_build_query(array_merge($_GET, array('pager' => '')), '', '&'); for($i = 1; $i <= 10; $i++) echo $url.$i; // vajadzētu būt ?type=desc&country=142&pager=$i Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.