if ステートメントを 2 つの異なるファイルに除外することは何とか可能ですか? 次のコードのようなものを書くと、解析エラーが発生します: syntax error, unexpected end of file
. どうやら、同じインクルード ファイル内の if ステートメントを常に閉じる必要があるようです。私が望むものを達成する方法はありますか?
index.php:
<?php
require "top.inc.php"; // opening the if statement
some code to execute if statement in top.inc.php is true
require "bottom.inc.php"; // closing the if statement
?>
top.inc.php:
<?php if (1 == 1) { ?>
ボトム.inc.php:
<?php } ?>