在控制器里我是这样写的
然后我在一个文本里输出了Json格式是这样的;
可是接收端老提示系统错误,百度了下说是编码不对,可我接收端开头已经写了
并且发送端控制器里也指定了UFT-8编码。
现在接收端就是接受不了数据说是系统错误。。
我用window.alert("ok");能成功
证明数据返回来了,可是错误处在VAR T这里老提示系统错误。。
请问怎么解决啊?
能否提供下代码?
回复讨论(解决方案)
header("Content-type: application/json")
试试
header("Content-type: application/json")
试试
不行啊在接收页面加入这句话把整个页面给我返回过来了。。关键的是数据还是没有获取到
提示的系统错误是错误: 系统错误: -1072896658。
这该怎么办啊
如果要返回json数据,你必须返回‘标准’的json数据, 这里说的标准不只是对于你json数据是标准的,而是在你的返回值中不能包含其他的非法项!
出现这种错误有可能是你在返回json数据之前或之后已经有了其他输出, 比如文件BOM头,我前几天就遇到了这种情况,我的php文件编码成UTF-8但是移植到linux下文件开头多了一个这个字符
-<?php................
就是那个小 -让我纠结了好久,最后把文件前面的 -全部删掉就好了!
也有可能你的其他部分的代码有输出 比如一个空格或者其它的什么东西!
4楼的我不明白我查看了我要输出的JSON数据,格式没问题可现在是我这边接收不到值
var t = myxml.responseText ;
这句话就是老出错,表示就是接受不到
Ajax 系统错误: -1072896658
如果XMLHttpRequest对象请求的文档未指定正确的utf-8编码,调用responseText方法时就会出现这个错误
浏览器系统错误:-1072896658(Explorer system error: -1072896658)
换个浏览器试试呢
虽然你在代码中加上了charset=utf8
但是你的PHP文件的实际编码是什么格式呢?
然后我在一个文本里输出了Json格式是没问题的, 中文使用了utf8编码。在前端javascript代码中增加类似下面的代码:
data = eval('(' + data + ')'); // 假设收到的内容保存在data中。
不行的话,你把所有牵涉的文件
*.php的都加上 header("Content-Type: text/html;charset=utf-8");
包括html文件中,嵌入javascript的地方加上charset="utf-8" <script></script>
你页面编码是否utf8?
把你那个Ajax对象就是myxml里面代码贴出来看看

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
