close

前言

以下的文章是從pear官方網站所擷取下來的(應該是沒有版權問題吧 ^^")

是大爺的學習筆記

所以如果翻譯有什麼地方有錯誤,請告知大爺,感恩哩 ^^

 

Pyrus relies upon PHP5's autoloading capabilities to automatically load a plugin class. All plugins should include the <autoloadpath> element to specify a path relative to the php_dir location for the plugin registry. For plugin classes that conform to PEAR2 standards, the autoloadpath should be an empty string:

(pyrus 依賴在PHP5的自動載入能力之上去自動載入一個外掛類別。所有外掛應該包含<autoloadpath>屬性去指定一個路徑相依為了外掛登錄php_dir位址。為了符合pear2標準的外掛類別,自動載入路徑應該為空字串:)


<autoloadpath></autoloadpath>

The pyrus autoloader will automatically replace _ and the namespace separator \ with DIRECTORY_SEPARATOR and append .php to determine the class name to load. To instruct Pyrus to prepend a particular relative path, put this path in the <autoloadpath> element. As an example, the following XML will prompt Pyrus to load the file /home/user/.pear/MyPackage/customcommands/Command/Line/Obj.php if the user's plugins_dir is /home/user/.pear:

(pyrus 自動載入將會自動地取代 _ 和名稱空間分隔符號包含DIRECTORY_SEPARATOR 和副檔名.php去決定載入的類別名稱。命令pyrus去預先計畫一個各別的相依路徑,放入這個路徑在<autoloadpath>屬性中。這裡有個範例,跟隨著XML將會及時的pyrus去載入檔案/home/user/.pear/MyPackage/customcommads/Commad/Line/obj.php 假如使用者的plugins_dir/home/user/.pear:)


<autoloadpath>MyPackage/customcommands</autoloadpath>
<class>Command_Line\Obj</class>

The <class> element is used by Pyrus to determine which object to instantiate. If <class> is:

(<class>屬性被pyrus使用去決定那一個物件來舉例說明。假如<class>是:)


<class>FooBar_Willy\Dilly</class>

Pyrus will instantiate an object of class FooBar_Willy\Dilly.

(pyrus將會舉例說明一個類別物件FooBar_Willy\Dilly。)

arrow
arrow
    全站熱搜

    大爺 發表在 痞客邦 留言(0) 人氣()