chdir() then dir() class will this open current directory?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

chdir() then dir() class will this open current directory?

Post by kendall »

Hello,

I have created a function the opens a dir

Code: Select all

<?php
// define root path
	chdir($BASEPATH); // set the current directory

	// if there is a category
	if(isset($category))
		chdir($category); // set current directory

	// if there is path
	if(isset($folder) && $folder != false)
		chdir($folder);// set current directory

	return	$dir = dir('.'); // open directory
?>
if $BASEPATH = /root/
and $category = /category/
and $folder = /folder/
would $dir = dir('.') = /root/category/folder/ ? Im having bit of a problem accessing some folders that i no are there i can't even seem to get a realpath(dir)

how is the chdir used with the dir() class??

Kendall
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

check that chdir() is successful, and use getcwd() to debug..
what path do you get?
Post Reply