1
我在使用@global
時在以下情況下是否正確?phpDocumentor和@global關鍵字
// File: my_special_class.php
<?php
...
class MySpecialClass {
function display_template() {
// Following variable will be available from context of 'template.php':
$instance = array('title' => 'Test Page');
include('template.php');
}
}
// File: template.php
<?php
/**
* Template for ...
*
* @copyright Me
* @version 1
*
* @global array $instance Template instance parameters.
*/
?>
<h1><?php echo $instance['title']; ?></h1>
是否有標準的文件記錄方式?
它主要是爲那些閱讀代碼的人提醒,但如果這些信息也出現在phpDocumentor生成的文檔中,它將會很有用。
我很擔心可能是這種情況。你知道添加一個新的自定義屬性'@ local'到phpdocumentor是多麼容易嗎? –
我不確定你想通過使用@local這樣的自定義標籤來突出顯示什麼,但是你肯定可以讓@local出現在你的文檔中。您可以通過在--customtags運行時選項中列出標記名稱來配置任何*種自定義標記(例如@foo,@bar,@treehouse) - http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor /tutorial_phpDocumentor.howto.pkg.html#using.command-line.customtags – ashnazg
感謝您的鏈接,我會試驗一下。我只想強調模板腳本中的變量範圍,以及它們的用途。 –