Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は私のプロジェクトで 2 つの部分を作成しました: 部分 1: php エンジンと部分 2: html テンプレート。
パート1には変数があります:
$test1 = 'This is a var.'; $test2 = 'this is another var.';
そしてパート2:私はコンテンツを持っています:
{echo $test1; echo $test2}
さて、part2でテンプレートを読み込み、part1で変数の値を表示できる関数を作りたいですか?
最も簡単な方法:
foo.php
<?php $test1 = 'This is a var.'; $test2 = 'this is another var.'; include 'foo.html';
foo.html
... <?php echo $test1 ?> <?php echo $test2 ?> ...