Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/396.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文件\u get\u contents()字符串后未加载JavaScript_Php_Javascript - Fatal编程技术网

输出PHP文件\u get\u contents()字符串后未加载JavaScript

输出PHP文件\u get\u contents()字符串后未加载JavaScript,php,javascript,Php,Javascript,我的结构如下: -uploadpage.html -index.php -resources -jquery-1.4.2.min.js -uploadpage.html -index.php -资源 -jquery-1.4.2.min.js 在我的index.php上,我获取内容,然后通过以下代码输出uploadpage.html: $output = file_get_contents("uploadpage.html"); echo $output; $output=file_get

我的结构如下:

-uploadpage.html -index.php -resources -jquery-1.4.2.min.js -uploadpage.html -index.php -资源 -jquery-1.4.2.min.js 在我的index.php上,我获取内容,然后通过以下代码输出uploadpage.html:

$output = file_get_contents("uploadpage.html"); echo $output; $output=file_get_contents(“uploadpage.html”); echo$输出; My upload.html底部有javascript:

<script type="text/javscript" src="./resources/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
 $(document).ready(
     function() {
      callSomething();
     }
 );
    function callSomething() {return true;}
</script>

$(文件)。准备好了吗(
函数(){
callSomething();
}
);
函数callSomething(){return true;}

但是,这会导致错误“$is not defined”,这意味着没有加载jquery js文件。有什么想法吗

jquery.1.4.2.min.js
jquery-1.4.2.min.js
如果这只是你问题中的一个输入错误,打开Firebug并查看“Net”选项卡,查看浏览器实际尝试加载的内容,以及尝试加载时会发生什么

如果这只是您问题中的一个输入错误,请打开Firebug并查看“网络”选项卡,查看浏览器实际尝试加载的内容,以及尝试加载时发生的情况。

更改:

type="text/javscript"
致:

更改:

type="text/javscript"
致:


也许这只是因为您没有像应该的那样,在站点中定义外部脚本,或者因为路径是“resources/jquery-1.4.2.min.js”,而不是“/resources/jquery-1.4.2.min.js”。PS:为什么你要乱搞文件内容(),你可以简单地执行“include('uploadpage.html')”?我练习将javascript放在结尾的body标记之前,就像其他人建议的那样(最后加载javascript,在开始时加载css)。路径没有问题。我尝试使用绝对路径,同样的问题也发生了。这与我的php代码有关。也许这只是因为你没有像应该的那样在网站中定义外部脚本,或者因为路径是“resources/jquery-1.4.2.min.js”,而不是“/resources/jquery-1.4.2.min.js”。PS:为什么你要乱搞文件内容(),你可以简单地执行“include('uploadpage.html')”?我练习将javascript放在结尾的body标记之前,就像其他人建议的那样(最后加载javascript,在开始时加载css)。路径没有问题。我尝试使用绝对路径,同样的问题也发生了。这与我的php代码有关。是的,这只是一个输入错误。在“网络”选项卡下,没有请求js是的,这只是一个输入错误。在“网络”选项卡下,没有js正在运行requested@mives当前位置这是你问题中的另一个打字错误吗?你知道当你有一个重要的facepalm时刻吗?我刚吃过。我没有在我的代码上看到那个奇怪的打字错误。世界跆拳道联盟。现在已经修好了。哦@米维斯:这是你问题中的另一个打字错误吗?你知道当你有一个重要的面部手掌瞬间时吗?我刚吃过。我没有在我的代码上看到那个奇怪的打字错误。世界跆拳道联盟。现在已经修好了。哦!