note 69049 deleted from function.chdir by sobak
| From: | sobak@php.net | Date: | Tue, 22 Nov 2016 08:30:36 +0000 |
| Subject: | note 69049 deleted from function.chdir by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207488@lists.php.net to get a copy of this message | ||
Note Submitter: andy dot clark at dial dot pipex dot com
----
This only changes the directory for PHP, the output directory stays the same. If you are trying to
access images from a relative path and you use the following then it will fail to render the image:
chdir ('images');
if (file_exists('php.gif'))
{
echo '<html>';
echo '<body>';
echo '<img src="php.gif">';
echo '</body></html>';
}
//However, it is possible to use the <base> tag in the header to change the directory for the
resulting HTML, as you can see however this requires you to put the full path in place.
chdir ('images');
if (file_exists('php.gif'))
{
echo '<html>';
echo '<head><base href = "http://uk.php.net/images/"></head>';
echo '<body>';
echo '<img src="php.gif">';
echo '</body></html>';
}