note 104432 added to function.include

From: Date: Wed, 15 Jun 2011 08:22:12 +0000
Subject: note 104432 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-180542@lists.php.net to get a copy of this message
When two different files located in separate directories try to INCLUDE/REQUIRE the relative file names, this may help you correctly FIND the included files. The code is a snapshot only. Your environment might change. <?php $now_at_dir = getcwd(); chdir(realpath(dirname(__FILE__).'/../../../somewhere/')); # Out of the general area require_once('a_differnet_path/browse_wine.php'); chdir($now_at_dir); ?> The basic trick is in saving the current directory, changing to the required directory, including the file, and then return back to the original directory. ---- Server IP: 69.147.83.197 Probable Submitter: 117.121.234.131 ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- https://master.php.net/note/edit/104432 Del: integrated -- https://master.php.net/note/delete/104432/integrated Del: useless -- https://master.php.net/note/delete/104432/useless Del: bad code -- https://master.php.net/note/delete/104432/bad+code Del: spam -- https://master.php.net/note/delete/104432/spam Del: non-english -- https://master.php.net/note/delete/104432/non-english Del: in docs -- https://master.php.net/note/delete/104432/in+docs Del: other reasons-- https://master.php.net/note/delete/104432 Reject -- https://master.php.net/note/reject/104432 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180542) next »