WP_CLI库需要require_once的正确路径是什么?

时间:2019-08-06 18:22:38

标签: php wordpress wp-cli

我正在尝试使用require_once ('...');创建class extended WP_CLI_Command。我通过以下方式安装了wp-cli.phar

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

之后

php wp-cli.phar --info

OS: Linux 5.0.0-23-generic #24~18.04.1-Ubuntu SMP Mon Jul 29 16:12:28 UTC 2019 x86_64
Shell:  /bin/bash
PHP binary: /usr/bin/php7.2
PHP version:    7.2.19-0ubuntu0.18.04.1
php.ini used:   /etc/php/7.2/cli/php.ini
WP-CLI root dir:    phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /var/www/html/wcexport/wp-content/plugins/export-csv
WP-CLI packages dir:    
WP-CLI global config:   /home/tomasz/.wp-cli/config.yml
WP-CLI project config:  
WP-CLI version: 2.2.0



class Hello_World_Command extends WP_CLI_Command {
    public function __invoke(){
        WP_CLI::success('Hello World');
    }
}
WP_CLI::add_command('hello', 'Hello_World_Command');

我想用作:

wp hello在命令行中

0 个答案:

没有答案