Home >Backend Development >PHP Tutorial >Summary of standard writing methods for PHPDocument code comments

Summary of standard writing methods for PHPDocument code comments

WBOY
WBOYOriginal
2016-07-25 08:57:10981browse
  1. /**

  2. * File name (sample2.php)
  3. * by bbs.it-home.org
  4. * Function description (omitted)
  5. * @package sample2
  6. */

  7. /**

  8. * Included files
  9. */
  10. include_once 'sample3.php';

  11. /**

  12. * Declare global variables
  13. * @global integer $GLOBALS['_myvar']
  14. * @name $_myvar
  15. */
  16. $GLOBALS['_myvar'] = 6;

  17. /**

  18. * Declare global constants
  19. */
  20. define('NUM', 6);

  21. /**

  22. * Class name
  23. *
  24. * Class function description
  25. *
  26. * @package sample2
  27. * @subpackage classes (if it is a parent class, add it)
  28. */
  29. class myclass {

  30. /**

  31. * Declare ordinary variables
  32. *
  33. * @accessprivate
  34. * @var integer|string
  35. */
  36. var $firstvar = 6;

  37. /**

  38. * Create constructor {@link $firstvar}
  39. */
  40. function myclass() {
  41. $this->firstvar = 7;
  42. }

  43. /**

  44. * Define function
  45. *
  46. * Function description
  47. *
  48. * @global string $_myvar
  49. * @staticvar integer $staticvar
  50. * @param string $param1
  51. * @param string $param2
  52. * @return integer|string
  53. */
  54. function firstFunc($param1, $param2 = 'optional') {
  55. static $staticvar = 7;
  56. global $_myvar;
  57. return $staticvar;
  58. }
  59. }
  60. ?>

复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn