강

if 문 하나 만들어주세요

php4x 입니다.

지금페이지 index.php 일때
<table><tr><td><img=test.jpg></td></tr></table> 출력이구요
아닐경우에는
<table><tr><td><img=testest></tr></table>

로 출력하는 if문 좀 부탁드립니다.<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>
|

댓글 4개

$php_self = explode("/", $_SERVER[PHP_SELF]);
$url_cnt = count($php_self) - 1;
$this_page = $php_self[$url_cnt];
if ($this_page = "index.php") {
} else {
}

요로코롬 쓰시면 되실듯합니다
좋은 방법이네요.

오타가 있었습니다.
$this_page = "index.php"

= -> ==
$file = basename($_SERVER["SCRIPT_NAME"]);

if ($file == "index.php") {
echo "<table><tr><td><img=test.jpg></td></tr></table>";
} else {
echo "<table><tr><td><img=testest></tr></table>";
}
더 간단한 방법이네요. ^^
댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

6,077건

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
11-02-17 조회 871
11-02-15 조회 6,927
11-02-15 조회 2,324
11-02-15 조회 1,787
11-02-15 조회 1,281
11-02-15 조회 1,130
11-02-15 조회 1,609
11-02-14 조회 1,357
11-02-14 조회 1,107
11-02-14 조회 4,381
11-02-14 조회 2,761
11-02-14 조회 1,062
11-02-13 조회 1,196
11-02-12 조회 1,676
11-02-11 조회 1,429
11-02-11 조회 1,653
11-02-10 조회 1,129
11-02-10 조회 1,067
11-02-08 조회 821
11-02-08 조회 1,982
11-02-07 조회 1,077
11-02-07 조회 1,227
11-02-07 조회 3,567
11-02-07 조회 1,313
11-02-06 조회 1,313