Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 直接将脚本排队,而不是先注册_Javascript_Php_Css - Fatal编程技术网

Javascript 直接将脚本排队,而不是先注册

Javascript 直接将脚本排队,而不是先注册,javascript,php,css,Javascript,Php,Css,注册样式表然后将其排队与直接将其排队有何不同 我在这里注册,然后排队 function calling_script(){ wp_register_style('bootstrap', get_template_uri(). `enter code here`'/css/bootstrap.min.css',array(),'1.0.0', 'all'); wp_enqueue_style('bootstrap'); wp_register_style('styl

注册样式表然后将其排队与直接将其排队有何不同

我在这里注册,然后排队

    function calling_script(){
    wp_register_style('bootstrap', get_template_uri(). `enter code here`'/css/bootstrap.min.css',array(),'1.0.0', 'all');
    wp_enqueue_style('bootstrap');
    wp_register_style('style', get_template_uri(). '/css/style.css',array(),'1.0.0', 'all');
    wp_enqueue_style('style');

}
add_action('wp_enqueue_style','calling_script');
在这里,我直接排队:

function calling_resources(){
    //Calling Styles
    wp_enqueue_style('style',get_stylesheet_uri(),'','1.0.0');
    wp_enqueue_style('comment_style',get_template_directory_uri().'/css/comments.css','','1.0.0');
    wp_enqueue_style('404 style',get_template_directory_uri().'/css/style-404.css','','1.0.0');

}
add_action('wp_enqueue_scripts','calling_resources');
两者工作原理相同。但我看到许多专家以这两种不同的方式进行研究

wp\U寄存器\U样式:-

这意味着,如果您想注册脚本,但不想直接将其加载到页面中,您可以注册一次文件,然后在需要时加载它们

wp_enque_风格:- 它可以帮助您加载脚本

wp\u register\u样式:-

这意味着,如果您想注册脚本,但不想直接将其加载到页面中,您可以注册一次文件,然后在需要时加载它们

wp_enque_风格:-
它可以帮助您加载脚本

您可以添加实际代码而不是图像吗?这将帮助更多与你有类似问题的人。你能添加实际代码而不是图片吗?这将帮助更多有类似问题的人。所以,我应该排队。好的,伙计,我应该排队。好的,伙计