php定名、注釋規範

來源:互聯網
上載者:User
php命名、注釋規範

一、注釋

1.檔案頭部模板

/** *這是一個什麼檔案 * *此檔案程式用來做什麼的(詳細說明,可選。)。 * @author      richard<[email protected]> * @version     $Id$ * @since        1.0 */  

2.函數頭部注釋

/** * some_func  * 函數的含義說明 * * @access public * @param mixed $arg1 參數一的說明 * @param mixed $arg2 參數二的說明 * @param mixed $mixed 這是一個混合類型 * @since 1.0 * @return array */  public function thisIsFunction($string, $integer, $mixed) {return array();}  

3.類的注釋

/** * 類的介紹 * * 類的詳細介紹(可選。)。 * @author         richard<[email protected]> * @since          1.0 */  class Test   {  }  

4.程式碼注釋

1). 注釋的原則是將問題解釋清楚,並不是越多越好。

2). 若干語句作為一個邏輯代碼塊,這個塊的注釋可以使用/* */方式。

3). 具體到某一個語句的注釋,可以使用行章節附註釋://。

/* 組建組態檔案、資料檔案。*/    $this->setConfig();  $this->createConfigFile();  //建立設定檔  $this->clearCache();         // 清除快取檔案  $this->createDataFiles();   // 產生資料檔案  $this->prepareProxys();  $this->restart();  

二、命名規範

http://alloyteam.github.io/code-guide/#project-naming

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.