note 72441 modified in function.include by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 May 2009 01:00:50 +0000 |
| Subject: | note 72441 modified in function.include by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155467@lists.php.net to get a copy of this message | ||
When I'm dealing with a package that uses relative includes of its own, rather than modify all
of their includes, I found it was easier to change PHP's working directory before and after the
include, like so:
<?php
$wd_was = getcwd();
chdir("/path/to/included/app");
include("mainfile.php");
chdir($wd_was);
?>
This way neither my includes nor theirs are affected; they all work as expected.
--was--
When I'm dealing with a package that uses relative includes of its own, rather than modify all
of their includes, I found it was easier to change PHP's working directory before and after the
include, like so:
<?
$wd_was = getcwd();
chdir("/path/to/included/app");
include("mainfile.php");
chdir($wd_was);
?>
This way neither my includes nor theirs are affected; they all work as expected.
http://php.net/manual/en/function.include.php