Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/465.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 当来自window.location时,Php不会执行_Javascript_Php_Xampp - Fatal编程技术网

Javascript 当来自window.location时,Php不会执行

Javascript 当来自window.location时,Php不会执行,javascript,php,xampp,Javascript,Php,Xampp,我有一个名为“savegame.php”的php文件 我使用xampp。当我手动输入“localhost/morabaraba/savegame.php”作为url时,它会工作 我在“savegame.php”文件所在的文件夹中有一个文件“index.html”,并使用window.location=“savegame.php”重定向 到c:\....\morabaraba\savegame.php,但它不会像“savegame.php”中的代码所说的那样回显或更新数据库 code in

我有一个名为“savegame.php”的php文件

我使用xampp。当我手动输入“localhost/morabaraba/savegame.php”作为url时,它会工作

我在“savegame.php”文件所在的文件夹中有一个文件“index.html”,并使用window.location=“savegame.php”重定向 到c:\....\morabaraba\savegame.php,但它不会像“savegame.php”中的代码所说的那样回显或更新数据库

   code in savegame.php
     <?php
              print 'i am working';
              //database updating details

      ?>
savegame.php中的代码
当我说输入localhost/morabaraba/savegame.php时,我的意思是在窗口中键入它,而不是在index.html文件中将其编码为window.location=“local/morabaraba/savegame.php”

是否使用本地服务器运行该文件?如果不这样做…通过“c:\”路径从硬盘加载文件不会通过PHP解释器。它指向“c:\…\morabaraba\savegame.PHP”是什么意思?你是说,对吗?不应该把window.location通过PHP解释器传递给我吗?JAL它给了我这个“file:///C:/xampp/htdocs/morabaraba/savegame.php". 我想这意味着它只是返回文件,而不是运行它?我是个新手。我怎么说“localhost/morabaraba/savegame.php”?我甚至尝试使用ajax,它只是说“找不到元素”