81) How we load all classes that placed in
different directory in one PHP File , means how to do auto load classes
Ans : by using
spl_autoload_register('autoloader::funtion');
Like below
class autoloader
{
public static function moduleautoloader($class)
{
$path = $_SERVER['DOCUMENT_ROOT'] . "/modules/{$class}.php";
if (is_readable($path)) require $path;
}
public static function daoautoloader($class)
{
$path = $_SERVER['DOCUMENT_ROOT'] . "/dataobjects/{$class}.php";
if (is_readable($path)) require $path;
}
public static function includesautoloader($class)
{
$path = $_SERVER['DOCUMENT_ROOT'] . "/includes/{$class}.php";
if (is_readable($path)) require $path;
}
}
spl_autoload_register('autoloader::includesautoloader');
spl_autoload_register('autoloader::daoautoloader');
spl_autoload_register('autoloader::moduleautoloader');
82) How many types of Inheritances used in PHP
and how we achieve it
Ans : As far PHP concern it only
support single Inheritance in scripting.
we can also use interface to achieve multiple inheritance.
83) PHP
how to know user has read the email?
Ans : Using Disposition-Notification-To: in mailheader we can get read
receipt.
Add the possibility to define a read receipt when sending an email.
It’s quite straightforward, just edit email.php, and add this at vars
definitions:
var $readReceipt = null;
And then, at ‘createHeader’ function add:
if (!empty($this->readReceipt)) {
$this->__header .= ‘Disposition-Notification-To: ‘ .
$this->__formatAddress($this->readReceipt) . $this->_newLine;
}
84) What are default session time and path?
Ans : default session time in PHP
is 1440 seconds or 24 minutes
Default session save path id temporary folder /tmp
85) how to track user logged out or not? when
user is idle ?
Ans :
85 By checking the session
variable exist or not while loading th page. As the session will exist longer
as till browser closes. The default behaviour for sessions is to keep a session
open indefinitely and only to expire a session when the browser is closed. This
behaviour can be changed in the php.ini file by altering the line
session.cookie_lifetime = 0 to a value in seconds. If you wanted the session to
finish in 5 minutes you would set this to session.cookie_lifetime = 300 and
restart your httpd server.
No comments:
Post a Comment