Wednesday 15 August 2012

PHP namespace in relation to file structure -


I do not know exactly how PHP namespace file works with strucutre

If I have some code

  & lt ;? PHP namespace go / use project Foo / bar / dog class enhances cat dog {.....}? & Gt;   

What is the file structure for something like this and I need to reflect that what I am doing in namespace and import in the structure of files or adding something to me Required () is in S.

It depends on your autoloader. Some frameworks use the standard, do not use anything. You can write your application without any autoloader and can write independent namespaces from your file structure. For example, you can declare the namespace Acme / Foo / Bar / Do / For / Me / Some / Thing code in this document> in index.php and all Files will be announced.

But if you do not want to write in every file, then the statement for your files statement is required, you can write your autoloader function and between the file structure and the namespace structure Dependency can be ensured.

No comments:

Post a Comment