Second question about PHP

来源:互联网 发布:冷子罪扣字软件下载 编辑:程序博客网 时间:2024/04/30 05:17

Today, I find a bewildering and fallacious point.

 

A class ,named a_dao.class.php, in DAO layer has codes as "require("./DBConnection.class.php")", and another one ,named b_dao.class.php, in DAO layer also has.

 

When I use both them as defined in another class "require("./dao/a_dao.class.php");require("./dao/b_dao.class.php")", it will say "Fatal error: Cannot redeclare class DBConnection inC:/Program Files/Apache Software Foundation/Apache2.2/htdocs/application/dao/DBConnection.class.php on line3".

I think this will take troubles to use, as we cann't require a class twice or more.

Why doesn't it require a class only once automatically like Java ?