Tiedostojen lisääminen PHP:ssä
Oletetaan, että meillä on yksi tiedosto:
index.php<?php
echo 'index';
?>
Oletetaan myös, että on toinen tiedosto:
test.php<?php
echo 'test';
?>
Liitetään toisen tiedoston sisältö
ensimmäiseen. Tämä tehdään käyttämällä
include-operaattoria:
index.php<?php
include 'test.php';
echo 'index';
?>
Samaa tiedostoa voi lisätä niin monta kertaa kuin haluaa:
index.php<?php
include 'test.php';
include 'test.php';
include 'test.php';
echo 'index';
?>
Задание 1
Tee tiedostot file1.php, file2.php,
file3.php. Liitä ne pää tiedostoosi.