I want to realize that when choosing a page the active menu would change.
There is a URL
/service/type/office_cleaning How to check if the /service line is in the /service/type/office_cleaning in php
I want to realize that when choosing a page the active menu would change.
There is a URL
/service/type/office_cleaning How to check if the /service line is in the /service/type/office_cleaning in php
$str = "/service/type/office_cleaning"; $sch = "/service"; if(stristr($str, $sch)):// Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΡΡΠΎΠΊΡ, ΡΠ΅Π³ΠΈΡΡΡΠΎΠ½Π΅Π·Π°Π²ΠΈΡΠΈΠΌΠ° echo "$sch in string \r\n"; endif; if(strstr($str, $sch)):// Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΡΡΠΎΠΊΡ, ΡΠ΅Π³ΠΈΡΡΡΠΎΠ·Π°Π²ΠΈΡΠΈΠΌΠ° echo "$sch in string \r\n"; endif; if(false !== stripos($str, $sch)):// Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΏΠΎΠ·ΠΈΡΠΈΡ ΠΏΠΎΠ΄ΡΡΡΠΎΠΊΠΈ ΠΈΠ»ΠΈ false, ΡΠ΅Π³ΠΈΡΡΡΠΎΠ½Π΅Π·Π°Π²ΠΈΡΠΈΠΌΠ° print_r('Π²Ρ
ΠΎΠΆΠ΄Π΅Π½ΠΈΠ΅ ΡΡΡΠΎΠΊΠΈ: ' . stripos($str, $sch) . "\r\n"); endif; if(false !== strpos($str, $sch)):// Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΏΠΎΠ·ΠΈΡΠΈΡ ΠΏΠΎΠ΄ΡΡΡΠΎΠΊΠΈ, ΡΠ΅Π³ΠΈΡΡΡΠΎΠ·Π°Π²ΠΈΡΠΈΠΌΠ° echo 'Π²Ρ
ΠΎΠΆΠ΄Π΅Π½ΠΈΠ΅ ΡΡΡΠΎΠΊΠΈ: ' . strpos($str, $sch) . "\r\n"; endif; if(false !== preg_match('/\$str/', $sch)):// ΠΏΡΠΎΠ²Π΅ΡΡΠ΅Ρ ΠΏΠΎ regex echo 'ΡΠΎΠΎΡΠ²Π΅ΡΡΡΠ²ΠΈΠ΅ ΡΡΡΠΎΠΊΠΈ: ' . preg_match('/\$str/', $sch) . "\r\n"; endif; And there who knows how many ways.
Source: https://ru.stackoverflow.com/questions/634089/
All Articles