You are here: Need help with class « PHP Programming Language « IT news, forums, messages
Need help with class

Posted by myzmlm on 01/22/08 18:41

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@127.0.0.1/pd';
}
function test(){
return 2;
}
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация