Support » Fixing WordPress » how to get content from a .txt file in functions.php

  • Resolved Wpkab

    (@wpkab)


    Hi
    I spent hours trying to make a simple thing which work in php environement but doesn’t with wordpress :

    How to open a simple .txt file and use its content within a function in the functions.php of the theme?

    My basic script is :

    <?php
    $fp = fopen ("fichier.txt", "r");
    $data = fgets ($fp);
    fclose ($fp);
    ?>

    Can I use this script in a function?
    Thanks for any help

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to get content from a .txt file in functions.php’ is closed to new replies.