Znany Znany - 2 months ago 8
PHP Question

How to edit file from another directory

How to import text from another file to html. i want to have file text.html

where is text:



<h2> some text </h2>





and just import to the index code.

Answer

A PHP file can include plain html files, txt files and of course other PHP files. Assuming this file is something.php it can show the content of text.html like this.

<?php include('text.html'); ?>