Home > front end >  How to open make hyperlink for txt files
How to open make hyperlink for txt files

Time:11-02

I created 3 text files and I want to create a bullet form list with hyperlinks that will direct the user to each file created. Is anyone able to help me out on how to code this or even suggest better methods?

echo "<ul>";
echo "<li>" . <a fopen("test.txt", "r") or die("Unable to open file!");>Test 1</a>  "</li>";
echo "<li>"  . $filename = 'test2.txt' . "</li>";
echo "/<ul>";

CodePudding user response:

Please note that /<ul> is not the correct closing tag, it should be </ul>

On the other hand, you may use the Nowdoc string quoting syntax (or similar):

<?php
echo <<<'EOD'

<ul>
<li><a href='test.txt'>Test1</a></li>
<li><a href='test2.txt'>Test2</a></li>
</ul>

EOD;

?>

For further reference on the above , please view the official documentation:

http://docs.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc

  • Related