使用Ajax加载PHP函数时,我在服务器错误日志中遇到此错误,尽管它没有问题。
AH01215: PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0: /usr/local/cpanel/cgi-sys/ea-php56
功能
$(window).load(function() {
$.ajax({
url: '/js/js.php',
type:'POST',
cache: false,
success: function(data){
if(data){
$('body').append(data);
}
}
});
})
的php.ini
; As of 4.0b4, PHP always outputs a character encoding by default in
; the Content-type: header. To disable sending of the charset, simply
; set it to be empty.
;
; PHP's built-in default is text/html
default_mimetype = "text/html"
;default_charset = "iso-8859-1"
; Always populate the $HTTP_RAW_POST_DATA variable.
;always_populate_raw_post_data = On
如何停止此错误?
答案 0 :(得分:1)
更改Post to GET后解决问题
$(window).load(function() {
$.ajax({
url: '/js/js.php',
type:'GET',
cache: false,
success: function(data){
if(data){
$('body').append(data);
}
}
});
})