0

我正在将 PHP 文档与我的产品集成,因为我计划允许用户更改插件中的各种内容。

到目前为止一切顺利,我的目录中有 phpdoc .phar,我可以解析 html 文件。但我有两个问题:

1 - 我不知道如何准确地使用@example 标签,

这是我的代码:

/**
     * Creates a custom cron schedule.
     * @param array $schedules list of schedules
     * @example class-wcdpue-admin.php add_filter( 'wcdpue_custom_cron_schedule', 300 ); Creates a custom cron
     * @since    2.0.0
     */
    public function wcdpue_custom_cron_schedule( $schedules ){

        $schedules['wcdpue_cron'] = array(

            'interval' => apply_filters( 'wcdpue_custom_cron_schedule', 900 ),
            'display' => __( 'Every 15 Minutes' )

        );

        return $schedules;

    }

当我检查 phpdoc 时,它显示如下:

它看起来如何

我不确定为什么它说找不到文件,但我在网上找不到使用此标签的示例,我希望它会在我的使用示例中显示一个小代码框。

2 - 如何解决找不到文件的问题?

类文件路径是oop/admin/class-wcdpue-admin.php,我尝试将 doc 块更改为:

/**
         * Creates a custom cron schedule.
         * @param array $schedules list of schedules
         * @example /admin/class-wcdpue-admin.php add_filter( 'wcdpue_custom_cron_schedule', 300 ); Creates a custom cron
         * @since    2.0.0
         */
        public function wcdpue_custom_cron_schedule( $schedules ){
    
            $schedules['wcdpue_cron'] = array(
    
                'interval' => apply_filters( 'wcdpue_custom_cron_schedule', 900 ),
                'display' => __( 'Every 15 Minutes' )
    
            );
    
            return $schedules;
    
        }

我正在运行的 phpdoc 命令是:php phpDocumentor.phar -d oop/ -t docs/api --sourcecode如果有任何帮助,由于某种原因,我也无法从渲染的 phpdoc 中看到我定义的任何块的源代码:

在此处输入图像描述

任何帮助表示赞赏

4

0 回答 0