문제

for example I have current link on which I want to redirect:

   if(stripos($_SERVER['REQUEST_URI'], 'post.php?post=5')!==false){
   //redirect
   }

But if the post ID would be post=55 it will redirect too... How to solve this problem ?

도움이 되었습니까?

해결책

Why don't you use $_GET variable?

if (isset($_GET['post']) && $_GET['post'] == 5) {
  ...
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top