dounai7148 2011-07-06 07:31
浏览 13
已采纳

PHP类和函数的注释?

I would like to add some documentation comments for my (PHP) class and its functions in some standard format so that its easier for others to understand.

I will appriciate if you can give me an example that how you would write comments for following class and function? Thanks.

Info about class:

Classname Photos: it has some functions related to uploading the photo and displaying the photos. function names are upload(), display(), delete().

Info about upload function:

uploads the resizes and uploads the image and has few parameters as shown below.

<?php
class Photos extends CI_Controller
{
    public function upload($file_name, $new_name, $new_width, $new_height, $directory)
    {
        ...
        ...
        returns true or false.
    }
  • 写回答

4条回答 默认 最新

  • dongrang2140 2011-07-06 07:37
    关注

    PHPDocumentor style is pretty standard and understood by most IDE's and documentation generators.

      /**
       * Photos
       * 
       * 
       * @package    CI
       * @subpackage Controller
       * @author     YOUR NAME <YOUREMAIL@domain.com>
       */
      class Photos extends CI_Controller
      {
    
          /**
           * 
           * Uploads a file
           *
           * @param string $file_name  description
           * @param string $new_name  description
           * @param integer $new_width  description
           * @param integer $new_height  description
           * @param string $directory  description
           * @return boolean
           */
          public function upload($file_name, $new_name, $new_width, $new_height, $directory)
          {
    
          }
       }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥40 图书信息管理系统程序编写
  • ¥15 7-1 jmu-java-m02-使用二维数组存储多元线性方程组
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题