downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

同一ファイル内での複数の名前空間の定義> <名前空間の定義
Last updated: Fri, 13 Nov 2009

view this page in

サブ名前空間の宣言

ディレクトリやファイルと同様、PHP の名前空間においても名前空間の階層構造を指定することができます。 このようにして名前空間を定義します。

例1 階層つきの名前空間の宣言

<?php
namespace MyProject\Sub\Level;

const 
CONNECT_OK 1;
class 
Connection /* ... */ }
function 
connect() { /* ... */  }

?>

上の例は、定数 MyProject\Sub\Level\CONNECT_OK とクラス MyProject\Sub\Level\Connection、 そして関数 MyProject\Sub\Level\connect を作成します。



add a note add a note User Contributed Notes
サブ名前空間の宣言
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites