There is a folder dir in it lies the file 1.php . 1.php file contains a mixture of html and php code. In general, this is the path to the dir/1.php file. And in the root of the site is the index.php file.

Task: when opening the index.php file, this file should completely copy the contents of dir/1.php into itself and perform so that the address bar http://домен.ру/index.php address at http://домен.ру/index.php , and not at http://домен.ру/dir/1.php .

How to implement this with PHP? (Apachevskaya not to offer the substitution of links, not the case.)

  • 2
    Interesting. if you don’t know about include, then what’s going on in your 1.php. No offense is said) - Yoharny Babai

3 answers 3

  1. include
  2. require
  3. include_once
  4. require_once

Listing index.php

 <?php include "dir/1.php"; ?> 

    index.php:

     <?php include '/dir/1.php'; 

    Only the best answers. Only without the Apache substitution links. ;)

      The answer to the question was given above. I will only explain the meaning of each of the four functions of the include:

       include - самое обычное и стандартное подключение require - если файл не будет найден, то PHP-скрипт закончит свою работу на этом месте include_once - то же самое, что и "include", только файл подключается только один раз require_once - то же самое, что и "require", только файл подключается только один раз