小编Kir*_*ill的帖子

PHP脚本的错误没有由$ .ajax处理

我有这些代码:

<script>
$.ajaxSetup({
 timeout:3000,
 success: function(){alert('True!!!');},
 error:function (){
                    alert('false');
                }
});
$.ajax({
 url:'test.php',
});
</script>
Run Code Online (Sandbox Code Playgroud)

我的'test.php'是:

<?
sleep(8);
$124415;
?>
Run Code Online (Sandbox Code Playgroud)

因此它有解析器错误,但ajax立即返回"True",但如果第二行有注释,则等待3秒.并返回"false".任何想法?我有更改代码test.php:

<? 
function shutdown() {
    header("HTTP/1.0 500 Internal Server Error");
ob_flush();
}
ob_start();
register_shutdown_function('shutdown');
spl_autoload_register('foo');// Fatal Error => Ajax false
//$112123123;//if turn on will be Parse Error => Ajax true
?>
Run Code Online (Sandbox Code Playgroud)

所以现在ajax警告我有关致命错误,但Parser Error没有捕获.有人知道这个问题的好方法吗?

php ajax jquery timeout

1
推荐指数
1
解决办法
536
查看次数

PHP.包含文件时添加符号'?' 无处不在!

我有一个包含函数的问题,这是一个问题:我有一个带字符串的index.php:

<td style="width: 62604px; height: 41px" class="style36"> <?  include('title.php');?></td>
Run Code Online (Sandbox Code Playgroud)

这是title.php:

<?php
echo 'some crazy stuff!';
?>
Run Code Online (Sandbox Code Playgroud)

这个文件里面的内容并不重要!因为,当我运行index.php脚本时:它总是显示'п»'符号代表'?' 在windows-1251 charset中.所以结果页面是:

<td style="width: 62604px; height: 41px" class="style36"> ?» some crazy stuff</td>
Run Code Online (Sandbox Code Playgroud)

php utf-8 include character-encoding echo

1
推荐指数
1
解决办法
464
查看次数

标签 统计

php ×2

ajax ×1

character-encoding ×1

echo ×1

include ×1

jquery ×1

timeout ×1

utf-8 ×1