CMS, 原创

codeigniter(CI)使用js实现ajax异步提交出现500 Internal Server Error

今天在使用 codeigniter(CI)异步(ajax)传输数据时总是出现500 internal server error。 分两种分析,首先 如果使用url访问能够正确显示而没有这个错误,大部分应该是这个问题:配置文件 config/config.php 中的 $config[‘csrf_protection’] = FALSE; 可能设置成里 TRUE。 只要修改成FALSE就可以正常了。 再有一种就是直接url访问也是500 internal server error。 那说明你的代码有问题里,应该是在contraler里面的对应的那个类文件有错误,这个错误可能是忘记了一个分号,或者其他错误,可以使用排除方式,就是将一部分内容注释起来,如果正常了,那错误就在注释的代码中,在缩小注释范围继续。这样就很容易找到错误的来源。希望对你有帮助。

When I user codeigniter(CI)  ajax to post data it display 500 internal server error. 1. if you put url into address,it display correct,you can solve it like this:  set $config[‘csrf_protection’] = FALSE; in config/config.php. 2.if the first doesnot work,  you put your url into address,it display none,and user debug found that 500 internal server error,there are errors in your code, look up your contraler code, may be just forgot a “;”,or other errors, you can annotate some code to debug,until it works.It is not that difficulty to find it. hope can help you.

(1414)

Related Post