php - @usedby 标签如何在 phpdoc 中工作

标签 php documentation phpdoc

通过使用@usedby 标签超链接不会出现在文档中。

Class Content
{
    /**
    * simple db class variable
    * @access public
    */
    var $_db=null; // db
    /**
    * s3 class instance
    */
    private $_s3=null; //  s3
    /**
    * application variable array for creating instance of each object 
    * @var array
    * @usedby Content::upload() this is compared 
    */
    public $application=array(
        'image'=>array(
                'createthumb'=>'createimagethumb'
                ),
        'audio'=>array(
                'createthumb'=>'createaudiothumb'
                ),
        'video'=>array(
                'createthumb'=>'createvideothumb'
                ),
        'link'=>array(
                'createthumb'=>'createlinkthumb'
                )
        );
/**
    * for uploading new content or you can say add new content :)
    *
    * @return json of new contents 
    **/
    function upload()
    {
        if ($_POST['gibname']=='' or $_POST['gibview']=='') {
            $msg=createmessage(false, 'Please enter gibname and gib view where you want to place content');
        }
        $maxFileSize = 100 * 1024 * 1024;   // Max file size 100 MB
        $thumb = $status =$imgWidth = $imgHeight = '';
        $headers = apache_request_headers();        // Get file size from Apache headers
        $fileSize=(int)$headers['Content-Length'];
        $fileType = (string)$headers['Content-Type']; // Get MIME type from Apache headers
        $clientfileType = $fileType;
        if (preg_match("/^multipart/", $fileType) ) $fileType = $_FILES['qqfile']['type'];
        if ($fileType=='application/octet-stream') $fileType="video/flv";
        if ($fileSize == 0) {
            return array('success'=>false, 'error'=>"File is empty.");
        }               
        if ($fileSize > $maxFileSize) {
            return array('success'=>false, 'error'=>"File is too large.");
        }
        $pathinfo = pathinfo($_REQUEST['qqfile']);        // Put data of pathinfo() array into $pathinfo    
        $filename = $pathinfo['filename'];// Get file name - eg: myphoto
        $ext = $pathinfo['extension'];        // Get extension - eg: .jpg
        if ($ext=='') $ext=substr(strrchr($_FILES['qqfile']['name'], '.'), 1);
        $originalName = $filename.'.'.$ext;
        $randName = uniqid();               // Generate unique id for the current object
        $fileTempName =  $randName . '.' . $ext;    // Unique file name with extension
        $fullTempName = "uploads/".$fileTempName;        // Set temp directory where files will be written temporarily        // Complete temp file name and path
        if (!preg_match("/^multipart/", $clientfileType)) { // Upload the file to temp directory on .net server
            $input = fopen("php://input", "r");
            $fp = fopen($fullTempName, "w");
            while ($data = fread($input, 1024)) {
                fwrite($fp,$data);
            }
            fclose($fp);
            fclose($input);         
        } else
            move_uploaded_file($_FILES["qqfile"]["tmp_name"], $fullTempName);
        $objecttype=mb_substr($fileType,0,-mb_strlen(strrchr($fileType,"/")));
        //for uploading of link url is neccesssary
        if ($_POST['url']!='' or $_POST['refername']!='') {
            $objecttype="link";
            $url=$_POST['url'];
            $filename=$_POST['filename'];
        } else {
            $url=CLOUDFRONT.$fileTempName;
            $filename=$fileTempName;
        }
        if (class_exists($objecttype) && $_POST['refername']=='') {
            $object=new $objecttype();
            $str=$this->application[$objecttype]['createthumb'];
            $thumb=$object->{$str}($fullTempName,$fileType);
            $thumbnail=$thumb['thumb'];
            $preview=$thumb['preview'];
            $imgWidth=$object->imagewidth;
            $imgHeight=$object->imageheight;
            $resize=$object->resize;
        }
}

虽然@usedby 不是警告来告诉未知标签。
phpdocumentor 版本是 1.4.3
为什么说未知标签。

最佳答案

“@usedby”标签不是 phpDocumentor 在您的文档块中查找的代码文档标签。有一个“@uses”标签表示“这个特定元素使用我在这个标签中列出的元素”。 phpDocumentor 会看到这个标签,在元素的文档上显示这个标签,建立到另一个元素的链接,在该其他元素的文档中放置一个 @usedby 标记。

简而言之,您将@uses 放在ThisElement 的文档块中以从ThisElement 指向ThatElement,而phpDocumentor 会将@usedby 放在ThatElement 的文档中以从ThatElement 指向到ThisElement。

关于php - @usedby 标签如何在 phpdoc 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5167878/

相关文章:

php - 用于模拟由新类对象调用的方法的单元测试

PHP、mySql 选择所有同名的

c# - 在使用SandcaSTLe的构建过程中自动生成html文档

javascript - 将 JSDoc 与命名空间和函数定义的变体形式结合使用

c - 使用 doxygen 文件头作为模块描述

php - 如何从 CLI 标准输入中读取非 ASCII 字符

php - 上传文件表单 - 无法识别 $_FILES 变量

documentation - 通过 "doc"解释源代码?

PhpDocumentor 2 在 'Transform analyzed project into artifacts' 时卡住

php 文件中的 phpdoc @var