使用任何 Jquery AJAX 请求加载 PHP 脚本导致脚本被返回并且不被服务器运行
Using any Jquery AJAX requests to load PHP script cause script to be returned and not run by server
我正在使用以下代码:
$.post( "includes/modules/list.php" );
而且我尝试了以下方法:
jQuery("#empty").load("/includes/modules/list.php", {}, function() {
refreshlist();
});
并且:
$.post("/includes/modules/list.php",function(data){
alert(data);
});
它在 IIS 上工作正常,但在切换到 Apache 后(我认为它实际上可以正常工作)它停止工作。
现在 IIS 服务器是由 Plesk 配置的,所以也许这与它有关?
这是我第一次post来这里,所以请原谅我的任何错误。
编辑:我是用 XAMPP 做的,这意味着 PHP 与它捆绑在一起。 PHP 脚本确实有效,我确实测试了 hello world 的东西并且它们都有效,但是当我尝试调用它时,它不起作用。
我正在使用 Windows。我正在认真讨论在 ASP.NET 中重写它并重新安装 IIS,但这已经花费了很多时间。这是一个个人项目,但我真的很想完成这项工作并能够使用 PHP,因为这是最主流的选择。
另一个编辑:这是我的 php -i 按要求转储(因为我不知道去哪里看)
SimpleXML
Simplexml support => enabled
Revision => $Id: a915862ec47f9589309acc4996ca8f6179788746 $
Schema support => enabled
soap
Soap Client => enabled
Soap Server => enabled
Directive => Local Value => Master Value
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400
sockets
Sockets Support => enabled
SPL
SPL support => enabled
Interfaces => Countable, OuterIterator, RecursiveIterator, SeekableIterator, Spl
Observer, SplSubject
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException,
BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryItera
tor, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIte
rator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthExcep
tion, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBo
undsException, OutOfRangeException, OverflowException, ParentIterator, RangeExce
ption, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilter
Iterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIterator
Iterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeE
xception, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHea
p, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStac
k, SplTempFileObject, UnderflowException, UnexpectedValueException
sqlite3
SQLite3 support => enabled
SQLite3 module version => 0.7-dev
SQLite Library => 3.8.4.3
Directive => Local Value => Master Value
sqlite3.extension_dir => no value => no value
standard
Dynamic Library Support => enabled
Path to sendmail => C:\xampp\mailtodisk\mailtodisk.exe
Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
default_socket_timeout => 60 => 60
from => no value => no value
url_rewriter.tags => a=href,area=href,frame=src,input=src,form=fakeentry => a=hr
ef,area=href,frame=src,input=src,form=fakeentry
user_agent => no value => no value
tokenizer
Tokenizer Support => enabled
wddx
WDDX Support => enabled
WDDX Session Serializer => enabled
xml
XML Support => active
XML Namespace Support => active
libxml2 Version => 2.9.1
xmlreader
XMLReader => enabled
xmlrpc
core library version => xmlrpc-epi v. 0.51
php extension version => 0.51
author => Dan Libby
homepage => http://xmlrpc-epi.sourceforge.net
open sourced by => Epinions.com
xmlwriter
XMLWriter => enabled
xsl
XSL => enabled
libxslt Version => 1.1.27
libxslt compiled against libxml Version => 2.7.8
EXSLT => enabled
libexslt Version => 0.8.16
zip
Zip => enabled
Extension Version => $Id: a9db166c839b24cbebccad95120bd535e720038f $
Zip version => 1.12.4
Libzip version => 0.11.2
zlib
ZLib Support => enabled
Stream Wrapper => compress.zlib://
Stream Filter => zlib.inflate, zlib.deflate
Compiled Version => 1.2.7.3
Linked Version => 1.2.7.3
Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value
Additional Modules
Module Name
Environment
Variable => Value
ALLUSERSPROFILE => C:\ProgramData
AMDAPPSDKROOT => C:\Program Files (x86)\AMD APP\
APPDATA => C:\Users\Xilence\AppData\Roaming
asl.log => Destination=file
CommonProgramFiles => C:\Program Files (x86)\Common Files
CommonProgramFiles(x86) => C:\Program Files (x86)\Common Files
CommonProgramW6432 => C:\Program Files\Common Files
COMPUTERNAME => AURORA51
ComSpec => C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK => NO
GPU_MAX_ALLOC_PERCENT => 50
HOMEDRIVE => C:
HOMEPATH => \Users\Xilence
HuluDesktopPath => C:\Users\Xilence\AppData\Local\HuluDesktop\instances[=16=].9.14.1
\HuluDesktop.exe
LOCALAPPDATA => C:\Users\Xilence\AppData\Local
LOGONSERVER => \AURORA51
MIBDIRS => C:/xampp/php/extras/mibs
MYSQL_HOME => C:\xampp\mysql\bin
NUMBER_OF_PROCESSORS => 4
OPENSSL_CONF => C:/xampp/apache/bin/openssl.cnf
OS => Windows_NT
Path => ;C:\xampp\;C:\xampp\php;C:\xampp\perl\site\bin;C:\xampp\perl\bin;C:\xamp
p\apache\bin;C:\xampp\mysql\bin;C:\xampp\FileZillaFTP;C:\xampp\MercuryMail;C:\xa
mpp\sendmail;C:\xampp\webalizer;C:\xampp\tomcat\bin;C:\Program Files (x86)\iis e
xpress\PHP\v5.6;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\AMD A
PP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\zpanel\bin\apache\bin;C:
\zpanel\bin\mysql\bin;C:\zpanel\bin\php;C:\zpanel\bin\wget;C:\zpanel\bin\bind\bi
n;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (
x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Co
rporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C
:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologi
es\ATI.ACE\Core-Static;C:\Program Files\Perforce;C:\Program Files (x86)\Windows
Live\Shared;C:\Program Files\Perforce\Server;C:\Program Files\Microsoft\Web Plat
form Installer\;;C:\Program Files\Perforce\Server
PATHEXT => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PHPRC => C:\xampp\php
PHP_PEAR_BIN_DIR => C:\xampp\php
PHP_PEAR_CFG_DIR => C:\xampp\php\cfg
PHP_PEAR_DATA_DIR => C:\xampp\php\data
PHP_PEAR_DOC_DIR => C:\xampp\php\docs
PHP_PEAR_INSTALL_DIR => C:\xampp\php\pear
PHP_PEAR_PHP_BIN => C:\xampp\php\php.exe
PHP_PEAR_SYSCONF_DIR => C:\xampp\php
PHP_PEAR_TEST_DIR => C:\xampp\php\tests
PHP_PEAR_WWW_DIR => C:\xampp\php\www
PROCESSOR_ARCHITECTURE => x86
PROCESSOR_ARCHITEW6432 => AMD64
PROCESSOR_IDENTIFIER => AMD64 Family 16 Model 4 Stepping 3, AuthenticAMD
PROCESSOR_LEVEL => 16
PROCESSOR_REVISION => 0403
ProgramData => C:\ProgramData
ProgramFiles => C:\Program Files (x86)
ProgramFiles(x86) => C:\Program Files (x86)
ProgramW6432 => C:\Program Files
PROMPT => Xilence@AURORA51$S$P$_#$S
PSModulePath => C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC => C:\Users\Public
SESSIONNAME => Console
SystemDrive => C:
SystemRoot => C:\Windows
TEMP => C:\Users\Xilence\AppData\Local\Temp
TMP => C:\xampp\tmp
USERDOMAIN => Aurora51
USERNAME => Xilence
USERPROFILE => C:\Users\Xilence
windir => C:\Windows
PHP Variables
Variable => Value
_SERVER["ALLUSERSPROFILE"] => C:\ProgramData
_SERVER["AMDAPPSDKROOT"] => C:\Program Files (x86)\AMD APP\
_SERVER["APPDATA"] => C:\Users\Xilence\AppData\Roaming
_SERVER["asl_log"] => Destination=file
_SERVER["CommonProgramFiles"] => C:\Program Files (x86)\Common Files
_SERVER["CommonProgramFiles(x86)"] => C:\Program Files (x86)\Common Files
_SERVER["CommonProgramW6432"] => C:\Program Files\Common Files
_SERVER["COMPUTERNAME"] => AURORA51
_SERVER["ComSpec"] => C:\Windows\system32\cmd.exe
_SERVER["FP_NO_HOST_CHECK"] => NO
_SERVER["GPU_MAX_ALLOC_PERCENT"] => 50
_SERVER["HOMEDRIVE"] => C:
_SERVER["HOMEPATH"] => \Users\Xilence
_SERVER["HuluDesktopPath"] => C:\Users\Xilence\AppData\Local\HuluDesktop\instanc
es[=16=].9.14.1\HuluDesktop.exe
_SERVER["LOCALAPPDATA"] => C:\Users\Xilence\AppData\Local
_SERVER["LOGONSERVER"] => \AURORA51
_SERVER["MIBDIRS"] => C:/xampp/php/extras/mibs
_SERVER["MYSQL_HOME"] => C:\xampp\mysql\bin
_SERVER["NUMBER_OF_PROCESSORS"] => 4
_SERVER["OPENSSL_CONF"] => C:/xampp/apache/bin/openssl.cnf
_SERVER["OS"] => Windows_NT
_SERVER["Path"] => ;C:\xampp\;C:\xampp\php;C:\xampp\perl\site\bin;C:\xampp\perl\
bin;C:\xampp\apache\bin;C:\xampp\mysql\bin;C:\xampp\FileZillaFTP;C:\xampp\Mercur
yMail;C:\xampp\sendmail;C:\xampp\webalizer;C:\xampp\tomcat\bin;C:\Program Files
(x86)\iis express\PHP\v5.6;C:\ProgramData\Oracle\Java\javapath;C:\Program Files
(x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\zpanel\bin\ap
ache\bin;C:\zpanel\bin\mysql\bin;C:\zpanel\bin\php;C:\zpanel\bin\wget;C:\zpanel\
bin\bind\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Prog
ram Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86
)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\Syst
em32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI
Technologies\ATI.ACE\Core-Static;C:\Program Files\Perforce;C:\Program Files (x8
6)\Windows Live\Shared;C:\Program Files\Perforce\Server;C:\Program Files\Microso
ft\Web Platform Installer\;;C:\Program Files\Perforce\Server
_SERVER["PATHEXT"] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
_SERVER["PHPRC"] => C:\xampp\php
_SERVER["PHP_PEAR_BIN_DIR"] => C:\xampp\php
_SERVER["PHP_PEAR_CFG_DIR"] => C:\xampp\php\cfg
_SERVER["PHP_PEAR_DATA_DIR"] => C:\xampp\php\data
_SERVER["PHP_PEAR_DOC_DIR"] => C:\xampp\php\docs
_SERVER["PHP_PEAR_INSTALL_DIR"] => C:\xampp\php\pear
_SERVER["PHP_PEAR_PHP_BIN"] => C:\xampp\php\php.exe
_SERVER["PHP_PEAR_SYSCONF_DIR"] => C:\xampp\php
_SERVER["PHP_PEAR_TEST_DIR"] => C:\xampp\php\tests
_SERVER["PHP_PEAR_WWW_DIR"] => C:\xampp\php\www
_SERVER["PROCESSOR_ARCHITECTURE"] => x86
_SERVER["PROCESSOR_ARCHITEW6432"] => AMD64
_SERVER["PROCESSOR_IDENTIFIER"] => AMD64 Family 16 Model 4 Stepping 3, Authentic
AMD
_SERVER["PROCESSOR_LEVEL"] => 16
_SERVER["PROCESSOR_REVISION"] => 0403
_SERVER["ProgramData"] => C:\ProgramData
_SERVER["ProgramFiles"] => C:\Program Files (x86)
_SERVER["ProgramFiles(x86)"] => C:\Program Files (x86)
_SERVER["ProgramW6432"] => C:\Program Files
_SERVER["PROMPT"] => Xilence@AURORA51$S$P$_#$S
_SERVER["PSModulePath"] => C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
_SERVER["PUBLIC"] => C:\Users\Public
_SERVER["SESSIONNAME"] => Console
_SERVER["SystemDrive"] => C:
_SERVER["SystemRoot"] => C:\Windows
_SERVER["TEMP"] => C:\Users\Xilence\AppData\Local\Temp
_SERVER["TMP"] => C:\xampp\tmp
_SERVER["USERDOMAIN"] => Aurora51
_SERVER["USERNAME"] => Xilence
_SERVER["USERPROFILE"] => C:\Users\Xilence
_SERVER["windir"] => C:\Windows
_SERVER["PHP_SELF"] =>
_SERVER["SCRIPT_NAME"] =>
_SERVER["SCRIPT_FILENAME"] =>
_SERVER["PATH_TRANSLATED"] =>
_SERVER["DOCUMENT_ROOT"] =>
_SERVER["REQUEST_TIME_FLOAT"] => 1420338712.5439
_SERVER["REQUEST_TIME"] => 1420338712
_SERVER["argv"] => Array
(
)
_SERVER["argc"] => 0
PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file: LICENSE
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license@php.net.
Xilence@AURORA51 c:\xampp
#
我对你的问题有点困惑,但我想你问的是当你的 php 页面被调用时 returns php 脚本而不是执行它(我不明白为什么 Ajax 在这里很重要 - 我假设如果您在浏览器中直接浏览到 php 页面也会发生同样的情况?)
我的第一个问题是您是否在服务器上安装了 php,因为这是这种情况下的常见问题?如果不是,假设它是 Linux 然后 运行 apt-get install php5(如果是 ubuntu、Debian 或类似 Mint)或 yum install php5(如果是Redhat Fedora或Centos)
如果安装了 php,请检查您的 httpd.conf(通常在 /etc/httpd/conf 中)并检查 php 模块是否正在加载 - 我不会进入关于此的大量详细信息,因为 Google 充满了关于 Apache 配置的好信息。
还要检查您的 php 页面是否可执行,因为它是一个脚本(ls -l yourphppagename.php 并查找左侧的 x 字符)
好的,我修好了。我真的很愚蠢,但在我编辑的某个地方,我删除了文档开头的 <?php
部分,只有 <?
,所以这导致它不被服务器解析,无论如何.. .非常感谢大家的帮助!应该首先将代码放在这里。下次我会的。再次感谢您!
我正在使用以下代码:
$.post( "includes/modules/list.php" );
而且我尝试了以下方法:
jQuery("#empty").load("/includes/modules/list.php", {}, function() {
refreshlist();
});
并且:
$.post("/includes/modules/list.php",function(data){
alert(data);
});
它在 IIS 上工作正常,但在切换到 Apache 后(我认为它实际上可以正常工作)它停止工作。
现在 IIS 服务器是由 Plesk 配置的,所以也许这与它有关?
这是我第一次post来这里,所以请原谅我的任何错误。
编辑:我是用 XAMPP 做的,这意味着 PHP 与它捆绑在一起。 PHP 脚本确实有效,我确实测试了 hello world 的东西并且它们都有效,但是当我尝试调用它时,它不起作用。
我正在使用 Windows。我正在认真讨论在 ASP.NET 中重写它并重新安装 IIS,但这已经花费了很多时间。这是一个个人项目,但我真的很想完成这项工作并能够使用 PHP,因为这是最主流的选择。
另一个编辑:这是我的 php -i 按要求转储(因为我不知道去哪里看)
SimpleXML
Simplexml support => enabled
Revision => $Id: a915862ec47f9589309acc4996ca8f6179788746 $
Schema support => enabled
soap
Soap Client => enabled
Soap Server => enabled
Directive => Local Value => Master Value
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400
sockets
Sockets Support => enabled
SPL
SPL support => enabled
Interfaces => Countable, OuterIterator, RecursiveIterator, SeekableIterator, Spl
Observer, SplSubject
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException,
BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryItera
tor, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIte
rator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthExcep
tion, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBo
undsException, OutOfRangeException, OverflowException, ParentIterator, RangeExce
ption, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilter
Iterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIterator
Iterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeE
xception, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHea
p, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStac
k, SplTempFileObject, UnderflowException, UnexpectedValueException
sqlite3
SQLite3 support => enabled
SQLite3 module version => 0.7-dev
SQLite Library => 3.8.4.3
Directive => Local Value => Master Value
sqlite3.extension_dir => no value => no value
standard
Dynamic Library Support => enabled
Path to sendmail => C:\xampp\mailtodisk\mailtodisk.exe
Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
default_socket_timeout => 60 => 60
from => no value => no value
url_rewriter.tags => a=href,area=href,frame=src,input=src,form=fakeentry => a=hr
ef,area=href,frame=src,input=src,form=fakeentry
user_agent => no value => no value
tokenizer
Tokenizer Support => enabled
wddx
WDDX Support => enabled
WDDX Session Serializer => enabled
xml
XML Support => active
XML Namespace Support => active
libxml2 Version => 2.9.1
xmlreader
XMLReader => enabled
xmlrpc
core library version => xmlrpc-epi v. 0.51
php extension version => 0.51
author => Dan Libby
homepage => http://xmlrpc-epi.sourceforge.net
open sourced by => Epinions.com
xmlwriter
XMLWriter => enabled
xsl
XSL => enabled
libxslt Version => 1.1.27
libxslt compiled against libxml Version => 2.7.8
EXSLT => enabled
libexslt Version => 0.8.16
zip
Zip => enabled
Extension Version => $Id: a9db166c839b24cbebccad95120bd535e720038f $
Zip version => 1.12.4
Libzip version => 0.11.2
zlib
ZLib Support => enabled
Stream Wrapper => compress.zlib://
Stream Filter => zlib.inflate, zlib.deflate
Compiled Version => 1.2.7.3
Linked Version => 1.2.7.3
Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value
Additional Modules
Module Name
Environment
Variable => Value
ALLUSERSPROFILE => C:\ProgramData
AMDAPPSDKROOT => C:\Program Files (x86)\AMD APP\
APPDATA => C:\Users\Xilence\AppData\Roaming
asl.log => Destination=file
CommonProgramFiles => C:\Program Files (x86)\Common Files
CommonProgramFiles(x86) => C:\Program Files (x86)\Common Files
CommonProgramW6432 => C:\Program Files\Common Files
COMPUTERNAME => AURORA51
ComSpec => C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK => NO
GPU_MAX_ALLOC_PERCENT => 50
HOMEDRIVE => C:
HOMEPATH => \Users\Xilence
HuluDesktopPath => C:\Users\Xilence\AppData\Local\HuluDesktop\instances[=16=].9.14.1
\HuluDesktop.exe
LOCALAPPDATA => C:\Users\Xilence\AppData\Local
LOGONSERVER => \AURORA51
MIBDIRS => C:/xampp/php/extras/mibs
MYSQL_HOME => C:\xampp\mysql\bin
NUMBER_OF_PROCESSORS => 4
OPENSSL_CONF => C:/xampp/apache/bin/openssl.cnf
OS => Windows_NT
Path => ;C:\xampp\;C:\xampp\php;C:\xampp\perl\site\bin;C:\xampp\perl\bin;C:\xamp
p\apache\bin;C:\xampp\mysql\bin;C:\xampp\FileZillaFTP;C:\xampp\MercuryMail;C:\xa
mpp\sendmail;C:\xampp\webalizer;C:\xampp\tomcat\bin;C:\Program Files (x86)\iis e
xpress\PHP\v5.6;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\AMD A
PP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\zpanel\bin\apache\bin;C:
\zpanel\bin\mysql\bin;C:\zpanel\bin\php;C:\zpanel\bin\wget;C:\zpanel\bin\bind\bi
n;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (
x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Co
rporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C
:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologi
es\ATI.ACE\Core-Static;C:\Program Files\Perforce;C:\Program Files (x86)\Windows
Live\Shared;C:\Program Files\Perforce\Server;C:\Program Files\Microsoft\Web Plat
form Installer\;;C:\Program Files\Perforce\Server
PATHEXT => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PHPRC => C:\xampp\php
PHP_PEAR_BIN_DIR => C:\xampp\php
PHP_PEAR_CFG_DIR => C:\xampp\php\cfg
PHP_PEAR_DATA_DIR => C:\xampp\php\data
PHP_PEAR_DOC_DIR => C:\xampp\php\docs
PHP_PEAR_INSTALL_DIR => C:\xampp\php\pear
PHP_PEAR_PHP_BIN => C:\xampp\php\php.exe
PHP_PEAR_SYSCONF_DIR => C:\xampp\php
PHP_PEAR_TEST_DIR => C:\xampp\php\tests
PHP_PEAR_WWW_DIR => C:\xampp\php\www
PROCESSOR_ARCHITECTURE => x86
PROCESSOR_ARCHITEW6432 => AMD64
PROCESSOR_IDENTIFIER => AMD64 Family 16 Model 4 Stepping 3, AuthenticAMD
PROCESSOR_LEVEL => 16
PROCESSOR_REVISION => 0403
ProgramData => C:\ProgramData
ProgramFiles => C:\Program Files (x86)
ProgramFiles(x86) => C:\Program Files (x86)
ProgramW6432 => C:\Program Files
PROMPT => Xilence@AURORA51$S$P$_#$S
PSModulePath => C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC => C:\Users\Public
SESSIONNAME => Console
SystemDrive => C:
SystemRoot => C:\Windows
TEMP => C:\Users\Xilence\AppData\Local\Temp
TMP => C:\xampp\tmp
USERDOMAIN => Aurora51
USERNAME => Xilence
USERPROFILE => C:\Users\Xilence
windir => C:\Windows
PHP Variables
Variable => Value
_SERVER["ALLUSERSPROFILE"] => C:\ProgramData
_SERVER["AMDAPPSDKROOT"] => C:\Program Files (x86)\AMD APP\
_SERVER["APPDATA"] => C:\Users\Xilence\AppData\Roaming
_SERVER["asl_log"] => Destination=file
_SERVER["CommonProgramFiles"] => C:\Program Files (x86)\Common Files
_SERVER["CommonProgramFiles(x86)"] => C:\Program Files (x86)\Common Files
_SERVER["CommonProgramW6432"] => C:\Program Files\Common Files
_SERVER["COMPUTERNAME"] => AURORA51
_SERVER["ComSpec"] => C:\Windows\system32\cmd.exe
_SERVER["FP_NO_HOST_CHECK"] => NO
_SERVER["GPU_MAX_ALLOC_PERCENT"] => 50
_SERVER["HOMEDRIVE"] => C:
_SERVER["HOMEPATH"] => \Users\Xilence
_SERVER["HuluDesktopPath"] => C:\Users\Xilence\AppData\Local\HuluDesktop\instanc
es[=16=].9.14.1\HuluDesktop.exe
_SERVER["LOCALAPPDATA"] => C:\Users\Xilence\AppData\Local
_SERVER["LOGONSERVER"] => \AURORA51
_SERVER["MIBDIRS"] => C:/xampp/php/extras/mibs
_SERVER["MYSQL_HOME"] => C:\xampp\mysql\bin
_SERVER["NUMBER_OF_PROCESSORS"] => 4
_SERVER["OPENSSL_CONF"] => C:/xampp/apache/bin/openssl.cnf
_SERVER["OS"] => Windows_NT
_SERVER["Path"] => ;C:\xampp\;C:\xampp\php;C:\xampp\perl\site\bin;C:\xampp\perl\
bin;C:\xampp\apache\bin;C:\xampp\mysql\bin;C:\xampp\FileZillaFTP;C:\xampp\Mercur
yMail;C:\xampp\sendmail;C:\xampp\webalizer;C:\xampp\tomcat\bin;C:\Program Files
(x86)\iis express\PHP\v5.6;C:\ProgramData\Oracle\Java\javapath;C:\Program Files
(x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\zpanel\bin\ap
ache\bin;C:\zpanel\bin\mysql\bin;C:\zpanel\bin\php;C:\zpanel\bin\wget;C:\zpanel\
bin\bind\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Prog
ram Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86
)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\Syst
em32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI
Technologies\ATI.ACE\Core-Static;C:\Program Files\Perforce;C:\Program Files (x8
6)\Windows Live\Shared;C:\Program Files\Perforce\Server;C:\Program Files\Microso
ft\Web Platform Installer\;;C:\Program Files\Perforce\Server
_SERVER["PATHEXT"] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
_SERVER["PHPRC"] => C:\xampp\php
_SERVER["PHP_PEAR_BIN_DIR"] => C:\xampp\php
_SERVER["PHP_PEAR_CFG_DIR"] => C:\xampp\php\cfg
_SERVER["PHP_PEAR_DATA_DIR"] => C:\xampp\php\data
_SERVER["PHP_PEAR_DOC_DIR"] => C:\xampp\php\docs
_SERVER["PHP_PEAR_INSTALL_DIR"] => C:\xampp\php\pear
_SERVER["PHP_PEAR_PHP_BIN"] => C:\xampp\php\php.exe
_SERVER["PHP_PEAR_SYSCONF_DIR"] => C:\xampp\php
_SERVER["PHP_PEAR_TEST_DIR"] => C:\xampp\php\tests
_SERVER["PHP_PEAR_WWW_DIR"] => C:\xampp\php\www
_SERVER["PROCESSOR_ARCHITECTURE"] => x86
_SERVER["PROCESSOR_ARCHITEW6432"] => AMD64
_SERVER["PROCESSOR_IDENTIFIER"] => AMD64 Family 16 Model 4 Stepping 3, Authentic
AMD
_SERVER["PROCESSOR_LEVEL"] => 16
_SERVER["PROCESSOR_REVISION"] => 0403
_SERVER["ProgramData"] => C:\ProgramData
_SERVER["ProgramFiles"] => C:\Program Files (x86)
_SERVER["ProgramFiles(x86)"] => C:\Program Files (x86)
_SERVER["ProgramW6432"] => C:\Program Files
_SERVER["PROMPT"] => Xilence@AURORA51$S$P$_#$S
_SERVER["PSModulePath"] => C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
_SERVER["PUBLIC"] => C:\Users\Public
_SERVER["SESSIONNAME"] => Console
_SERVER["SystemDrive"] => C:
_SERVER["SystemRoot"] => C:\Windows
_SERVER["TEMP"] => C:\Users\Xilence\AppData\Local\Temp
_SERVER["TMP"] => C:\xampp\tmp
_SERVER["USERDOMAIN"] => Aurora51
_SERVER["USERNAME"] => Xilence
_SERVER["USERPROFILE"] => C:\Users\Xilence
_SERVER["windir"] => C:\Windows
_SERVER["PHP_SELF"] =>
_SERVER["SCRIPT_NAME"] =>
_SERVER["SCRIPT_FILENAME"] =>
_SERVER["PATH_TRANSLATED"] =>
_SERVER["DOCUMENT_ROOT"] =>
_SERVER["REQUEST_TIME_FLOAT"] => 1420338712.5439
_SERVER["REQUEST_TIME"] => 1420338712
_SERVER["argv"] => Array
(
)
_SERVER["argc"] => 0
PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file: LICENSE
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license@php.net.
Xilence@AURORA51 c:\xampp
#
我对你的问题有点困惑,但我想你问的是当你的 php 页面被调用时 returns php 脚本而不是执行它(我不明白为什么 Ajax 在这里很重要 - 我假设如果您在浏览器中直接浏览到 php 页面也会发生同样的情况?)
我的第一个问题是您是否在服务器上安装了 php,因为这是这种情况下的常见问题?如果不是,假设它是 Linux 然后 运行 apt-get install php5(如果是 ubuntu、Debian 或类似 Mint)或 yum install php5(如果是Redhat Fedora或Centos)
如果安装了 php,请检查您的 httpd.conf(通常在 /etc/httpd/conf 中)并检查 php 模块是否正在加载 - 我不会进入关于此的大量详细信息,因为 Google 充满了关于 Apache 配置的好信息。
还要检查您的 php 页面是否可执行,因为它是一个脚本(ls -l yourphppagename.php 并查找左侧的 x 字符)
好的,我修好了。我真的很愚蠢,但在我编辑的某个地方,我删除了文档开头的 <?php
部分,只有 <?
,所以这导致它不被服务器解析,无论如何.. .非常感谢大家的帮助!应该首先将代码放在这里。下次我会的。再次感谢您!