Page 1 of 1
Classes and Functions + Include/Require
Posted: Tue Sep 27, 2011 5:01 pm
by Wolf95
Hello, I was wondering about php classes and functions. I was wondering how I would program classes with functions, and how I would go about calling multiple functions from the same class? Also, when I want to include a page that only has php on it do I not close the php script with the ?>?, And also how would I include files that are in a directory stored in relation to a folder, thanks
Re: Classes and Functions + Include/Require
Posted: Wed Sep 28, 2011 12:36 am
by Christopher
Wolf95 wrote:Hello, I was wondering about php classes and functions. I was wondering how I would program classes with functions, and how I would go about calling multiple functions from the same class?
http://www.php.net/manual/en/language.oop5.basic.php
Wolf95 wrote:Also, when I want to include a page that only has php on it do I not close the php script with the ?>?,
You can, but you don't need to.
Wolf95 wrote:And also how would I include files that are in a directory stored in relation to a folder, thanks
To include a file above the current directory use '..' such as '../../file.php' includes a file two directory levels up from the current directory. For below the current directory just do 'dir1/dir2/file.php'. In general, it is better to user absolute paths if you can.