채택완료

if문 url 확인하는 방법 부탁드립니다.

2017-12-30 (토) 12:13:31 4,604
Copy
<?php if('/bbs/board.php?bo_table=property16') { // 메인페이지일 때 ?>
<img width="580px" src="/theme/basic/img/business_img1.jpg">
<?php } else { //서브페이지일 때 ?>
<img width="580px" src="/theme/basic/img/business_img2.jpg">
<?php } ?>

if에 있는 url을 확인해서 else일 때 다른 이미지를 보여주게 하고 싶은데요.

어떻게 해야되나요?

|

답변 2개 / 댓글 2개

채택된 답변
+20 포인트
2017-12-30 (토) 12:15:58

<?php if($bo_table ==  'property16') { // property16 게시판 일때

답변에 대한 댓글 1개

감사합니다. ㅎㅎ
Copy
<?php if($_SERVER['REQUEST_URI'] == '/bbs/board.php?bo_table=property16') { // 메인페이지일 때 ?> <img width="580px" src="/theme/basic/img/business_img1.jpg">

<?php } else { //서브페이지일 때 ?>

<img width="580px" src="/theme/basic/img/business_img2.jpg">

<?php } ?>

답변에 대한 댓글 1개

감사합니다. $_SERVER['REQUEST_URI'] 적어놔야겠네요. ㅎ

답변을 작성하려면 로그인이 필요합니다.