You are here: Re: require_once doesn't work, "cannot redeclare class..." « PHP Programming Language « IT news, forums, messages
Re: require_once doesn't work, "cannot redeclare class..."

Posted by Tommy Gildseth on 02/24/06 22:07

Erwin Moller wrote:

>
> So you might expect that PHP is counting the number os time a certain file
> is required, but that is NOT what it says: It only look for THE SAME FILE.
>
> The difference might not seem big, but this is excactly what causes your
> problem: Your include is used in different files, and thus included every
> time, hence the multiple declaration.


No, PHP has more intelligence when it comes to require_once than that, and
will recognise that they are both the same file, even though they are being
included via 2 different files.
This even holds true if you chdir('somedir') and use a different path to
include the same file.

--
Tommy
http://design.twobarks.com/

 

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

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