如何在插件激活时在wordpress中移动文件


How to Move file in wordpress on plugin activation

我想在插件激活时在wordpress中移动文件。我已经为此编写了一个代码,但它不起作用。

function onactivation_install(){
    $src = ABSPATH . 'wp-content/plugins/sinetiks-schools/plugin_list.php';
    $dest = get_template_directory();
    $full_path = $dest.'/';
    $flag = wp_handle_upload($src,$full_path);
    var_dump($flag);    }
register_activation_hook( __FILE__,'onactivation_install' );

传递此参数

$flag = wp_handle_upload($src,array( 'test_form' => false ));