Need help with class
- From: myzmlm@xxxxxxxxx
- Date: Tue, 22 Jan 2008 10:41:01 -0800 (PST)
I want to include class in one php page. However I couldn't get it
working? I didn't get any error message but I didn't get the html page
either. Any one could help me? Thanks.
<?php
function __autoload($class)
{
if (file_exists($file = "$class.php"))
{
include($file);
}
else
{
throw new Exception("Class $class not found");
}
}
try
{
class_exists('pd');
$remo = new pd();
?>
<html>
<head>
</head>
<body>
<div id='div1'>test<br />
<?php
print $remo.test();
print "sssssss";
}
catch (Exception $e)
{
// Catch the exception and handle it as usual
throw new Exception($e->getMessage());
}
?>
</div>
</body>
</html>
pd.php
class pd{
private $dsn;
function _pd() {
$dsn = 'mysql://pd:password@xxxxxxxxx/pd';
}
function test(){
return 2;
}
}
.
- Follow-Ups:
- Re: Need help with class
- From: Rik Wasmus
- Re: Need help with class
- Prev by Date: Re: sort based on substring
- Next by Date: Re: Regular Expression: How the rule is applied for the Pattern '/((red|white) (king|queen))/'
- Previous by thread: sort based on substring
- Next by thread: Re: Need help with class
- Index(es):
Relevant Pages
|