Using require_once for up directory not working

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Using require_once for up directory not working

Postby flashery » 06. January 2013 17:30

I am using require_once like this

Code: Select all
 require_once('../mycode.php')


I am a developing a wordpress plugin. My plugin folder is yves-slider. Where I have a file called yves-slider.php and a folder called admin. Inside admin folder I have a file called admin.php. I want to require file yves-slider.php in my admin.php which is located up one level directory. When I try to use

Code: Select all
 require_once('../yves-slider.php')


it gives me error
==============================================================================================================================
Warning: require_once(../yves-slider.php): failed to open stream: No such file or directory in C:\xampp\htdocs\wordpress\wp-content\plugins\yves-slider\yves-slider-admin\yves-slider-admin.php on line 4

Fatal error: require_once(): Failed opening required '../yves-slider.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\wordpress\wp-content\plugins\yves-slider\yves-slider-admin\yves-slider-admin.php on line 4
==============================================================================================================================

Am I doing wrong? I am using XAMPP 3.1, I guess that's the best way to do it.
flashery
 
Posts: 1
Joined: 06. January 2013 16:54
Operating System: Window 7

Re: Using require_once for up directory not working

Postby Altrea » 06. January 2013 19:06

Hi flashery,


best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 160 guests