채택완료

echo안에 include가 들어갈순업나요?

메인화면이면 main.html

서브화면이면 sub.html

이 출력되게 하고 싶은데요

 

<? if ( isset($isMain) )

echo " ";

else echo " ";
?> 

 



​이런식으로 하려고 하는데

 

ehco안에는 include를 넣을수가없는건가요? 

|

답변 2개

채택된 답변
+20 포인트

include 안에는 echo(출력)이 없다는 말씀이죠?

 

버퍼링 함수를 사용해 보세요.

http://php.net/manual/kr/ref.outcontrol.php

 

http://php.net/manual/kr/function.ob-get-contents.php

<? if ( isset($isMain) )

include 'main.html'; 

else  

include 'sub.html';

?> 

 

위처럼 할면 되실텐데요? 

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