Inkludera filer i PHP
Låt oss säga att vi har en fil:
<?php
echo 'index';
?>
Låt oss säga att det också finns en andra fil:
<?php
echo 'test';
?>
Låt oss inkludera innehållet från den andra
filen i den första. Detta görs med kommandot
include:
<?php
include 'test.php';
echo 'index';
?>
Samma fil kan inkluderas hur många gånger som helst:
<?php
include 'test.php';
include 'test.php';
include 'test.php';
echo 'index';
?>
Skapa filerna file1.php, file2.php,
file3.php. Inkludera dem i din
huvudfil.