Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/407.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
Php Wordpress javascript文件调用返回奇怪的路径_Php_Javascript_Jquery_Html_Wordpress - Fatal编程技术网

Php Wordpress javascript文件调用返回奇怪的路径

Php Wordpress javascript文件调用返回奇怪的路径,php,javascript,jquery,html,wordpress,Php,Javascript,Jquery,Html,Wordpress,我正在尝试使用推荐的方法wp\u enqueue\u script <?php function wptuts_scripts_with_jquery() { // Register the script like this for a plugin: wp_register_script( 'customScripts', plugins_url( '/js/customScripts.js', __FILE__ ), array( 'jquery' ) )

我正在尝试使用推荐的方法
wp\u enqueue\u script

<?php

function wptuts_scripts_with_jquery()  
{  
    // Register the script like this for a plugin:  
    wp_register_script( 'customScripts', plugins_url( '/js/customScripts.js', __FILE__ ), array( 'jquery' ) );  
    // or  
    // Register the script like this for a theme:  
    wp_register_script( 'customScripts', get_template_directory_uri() . '/js/customScripts.js', array( 'jquery' ) );  
    // For either a plugin or a theme, you can then enqueue the script:  
    wp_enqueue_script( 'customScripts' );  
}  
add_action( 'wp_enqueue_scripts', 'wptuts_scripts_with_jquery' ); 

?>
这显然是错误的。我不认为这与在本地主机上开发(使用MicrosoftWebMatrix 2)有任何关系,但更重要的是Wordpress破译路径的方式?我不确定

我怎样才能让它吐出正确的路径

twentywelve-child/js/customScripts.js 
谢谢。

试试这个
插件的url('js/customScripts.js',\uuuu文件)
而不是
插件的url('/js/customScripts.js',\uu文件)
(删除第一个斜杠)

看:

twentywelve-child/js/customScripts.js