版本4.9.1 wp排队脚本无法正常工作

I am using wordpress to add a cdn , this kind of thing works well with css with wp_styles . It seems to convert the link to the localhost link plus the cdn. My code echos:

http://tavlin.daniellowes.com/wp-content/plugins/home/aborigi6/public_html/tavlin/wp-content/themes/twentyseventeen/https:/cdnjs.cloudflare.com/ajax/libs/aos/2.2.0/aos.js?ver=1.1

It should echo
https:/cdnjs.cloudflare.com/ajax/libs/aos/2.2.0/aos.js?ver=1.1

Here is the problematic php code code:

function aos() { 

        wp_register_script( 'aos', 'https://cdnjs.cloudflare.com/ajax/libs/aos/2.2.0/aos.js', array('jquery'), 3.3, true); 
        wp_enqueue_script('aos'); 

    }

    add_action('wp_enqueue_scripts', 'aos');

You can try this:

<?php

function aos() { 
    wp_register_script( 'aos', '//cdnjs.cloudflare.com/ajax/libs/aos/2.2.0/aos.js', array('jquery'), '3.3', true ); 
    wp_enqueue_script('aos'); 
}
add_action('wp_enqueue_scripts', 'aos');

?>

try this:

function wpdocs_theme_name_scripts() {
    wp_enqueue_script( 'aos', 'https://cdnjs.cloudflare.com/ajax/libs/aos/2.2.0/aos.js', array('jquery'), 3.3, true); 

}
add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );

As I can see in the code you provided, all must work without any problems. Your js must be enqueued as you want.

The problems may issued by: .htaccess rewrited rules, some plugin, which is forcing all your scripts through some filter, the function from your theme/or some code added into your theme files.

We can't provide you more information, because can't see backend part of your website. If you( or somebody else ) didn't added/changed some code from .php files, didn't add some js script and didn't add some rules into your .htaccess file, than your first step must be to check plugins( plugins, which forcing urls from http to https, adding some expiration dates, caching content, adding some rules from options, generating cdn urls and etc. ) options, .htaccess file, then theme functions.php file.

I can guess, that your url changed twice with 2 different functions. First is adding http://tavlin.daniellowes.com/wp-content/plugins/ to your enqueued script url, and second is adding home/aborigi6/public_html/tavlin/wp-content/themes/twentyseventeen/.

Another way to check, where filter is used( if its done with filter ), is to hook into some other action, like

function aos() { 
wp_register_script( 'aos', 'https://cdnjs.cloudflare.com/ajax/libs/aos/2.2.0/aos.js', array('jquery'), 3.3, true); 
    wp_enqueue_script('aos'); 

}

add_action('wp_head', 'aos');

or to some other hook you need.