PHP namespaces notes
1.php file code is as follows
<pre>
<PHP?
// I expressed in this article namespace in the module under Blog
namespace Blog \ Article This article was;
Comment {class
function the __construct () {// Initialize the object, the initial values in parentheses
echo 'initializing';
}
}
?>
</pre>
2.php file code below
<pre>
<PHP?
The require '1.php';
// Call Blog \ Article spaces like
$ article_comment = new \ Blog \ Article \ Comment ();
/*require '1.php';
use Blog\Article\Comment;
$article_comment = new Comment();*/
/*namespace Blog\Article;
require '1.php';
$article_comment = new Comment();*/
?>
</pre>