Support » Plugin: Code Widget » PHP code not executing

  • Resolved Phil Emery

    (@noise)


    When the code

    <?php include( 'https://******/wp-content/themes/themename/doc-display.php' ) ; ?>

    The content of the file is not included

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sharaz Shahid

    (@sharaz)

    Hi @noise,

    I think you’re using the include function wrong way. Include function work with file location path (starting with a drive letter or \ on Windows, or / on Unix/Linux systems) or relative to the current directory (starting with . or ..) not URL base path.
    For more information check the documention.
    https://www.php.net/manual/en/function.include.php

    let me know if your problem solved.

    Thread Starter Phil Emery

    (@noise)

    Actually on the page referred:

    <?php
    
    /* This example assumes that www.example.com is configured to parse .php
    * files and not .txt files. Also, 'Works' here means that the variables
    * $foo and $bar are available within the included file. */
    
    // Won't work; file.txt wasn't handled by www.example.com as PHP
    include 'http://www.example.com/file.txt?foo=1&bar=2';
    
    // Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
    // local filesystem.
    include 'file.php?foo=1&bar=2';
    
    // Works.
    include 'http://www.example.com/file.php?foo=1&bar=2';
    ?>
    • This reply was modified 1 year, 5 months ago by Phil Emery.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP code not executing’ is closed to new replies.