We won again!

Great victory for the People - Tax Cut!

Home Forums Tech Web Development Loading a PHP file without hard-coding the path


Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /var/www/DWCTEST/wp-includes/functions.php on line 6131

Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /var/www/DWCTEST/wp-includes/functions.php on line 6131
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #2278

    Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /var/www/DWCTEST/wp-includes/functions.php on line 6131

    Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /var/www/DWCTEST/wp-includes/functions.php on line 6131
    Udar Gromov
    Keymaster

    This is a simple way to include a PHP file without hard-coding either an absolute file location, or relative to a directory, where the file is loaded from:

    <?php
    require($_SERVER['DOCUMENT_ROOT'] .
    "wp-contentyou-pathyour-file-name.php");
    ?>

    This was tested on Windows IIS. On Unix machines you would need to change back slash to a front slash (‘/’)

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.