dimanche 4 octobre 2015

Why is this require statement not working?

I am faced with this strange issue when the script loads it gives me and error:

[04-Oct-2015 18:36:04 UTC] PHP Warning: require(../main/otherfile.php): failed to open stream: No such file or directory in C:\xampp\htdocs\wordpress\wp-content\plugins\myplugin\main\main-file.php on line 30

why is the otherfile.php not loading correctly ? Here are the contents of the files:

Content of main-file.php

require '../inc/otherfile.php';

Content of myplugin.php

class Myplugin{
    function __construct(){
        add_action( 'init', array('this',init) );
    }

    function init(){
        require 'main-file.php';
    }

}
new Myplugin;

file structure

myplugin
    main
        myplugin-class.php
        main-file.php
        inc
            otherfile2.php
            otherfile3.php



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire