我用浏览器自带的调试工具截获的传输数据是这样的:
Remote Address:110.173.51.13:80Request URL:http://1.cp556677.com/index.php/game/postCodeRequest Method:POSTStatus Code:200 OKRequest Headersview sourceAccept:application/json, text/javascript, */*; q=0.01Accept-Encoding:gzip,deflateAccept-Language:zh-CN,zh;q=0.8Connection:keep-aliveContent-Length:416Content-Type:application/x-www-form-urlencoded; charset=UTF-8Cookie:safedog-flow-item=79F5EE718A; mode=0.02; PHPSESSID=geoneh9vdsg9nlo21251iho006; fanDian=0Host:1.cp556677.comOrigin:http://1.cp556677.comReferer:http://1.cp556677.com/index.phpUser-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36 SE 2.X MetaSr 1.0X-Requested-With:XMLHttpRequestForm Dataview sourceview URL encodedcode[0][fanDian]:0code[0][bonusProp]:19.40code[0][mode]:0.02code[0][beiShu]:1code[0][orderId]:105178437687code[0][actionData]:-,-,01234,-,-code[0][actionNum]:5code[0][weiShu]:0code[0][playedGroup]:6code[0][playedId]:37code[0][type]:1para[type]:1para[actionNo]:20150924-026para[kjTime]:1443061200Response Headersview sourceCache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0Connection:Keep-AliveContent-Length:26Content-Type:application/jsonDate:Thu, 24 Sep 2015 02:13:05 GMTExpires:Thu, 19 Nov 1981 08:52:00 GMTKeep-Alive:timeout=5, max=95Pragma:no-cacheServer:Apache/2.4.7 (Win32) OpenSSL/0.9.8y PHP/5.3.28X-Powered-By:PHP/5.3.28
我自己提交的时候不是提示500错误,就是返回空,数据哪里应该是json数据,不知道json数据应该怎么返回,网站是用jQuery提交的,提交的相关代码是这样的:
$.ajax('/index.php/game/postCode', { data:{ code:code, para:data, zhuiHao:zhuiHao }, type:'post', dataType:'json', error:function(xhr, textStatus, errorThrown){ gamePostedCode(errorThrown||textStatus); }, success:function(data, textStatus, xhr){ gamePostedCode(null, data); if(data) winjinAlert(data,"ok"); },
我应该怎么样用程序模拟这个提交的过程,是不是提交json,有不一样的格式?
回复讨论(解决方案)
$.ajax('/index.php/game/postCode' 这个能成功提交到php里吗
$.ajax('/index.php/game/postCode' 这个能成功提交到php里吗
能
你在php脚本里,返回json格式数据时,用json_encode($arr)处理下
你在php脚本里,返回json格式数据时,用json_encode($arr)处理下
我是想知道这些参数是怎么传送过去的,如果变成网址是什么样的,如果自己模拟,应该是怎么模拟?不用ajax怎么模拟发送?
post提交的数据会被用urlencode处理。自己模拟那用curl模拟post提交吧
urlencode:
返回字符串,此字符串中除了 -_. 之外的所有非字母数字字符都将被替换成百分号(%)后跟两位十六进制数,空格则编码为加号(+)。此编码与 WWW 表单 POST 数据的编码方式是一样的,同时与 application/x-www-form-urlencoded 的媒体类型编码方式一样
post提交的数据会被用urlencode处理。自己模拟那用curl模拟post提交吧
urlencode:
返回字符串,此字符串中除了 -_. 之外的所有非字母数字字符都将被替换成百分号(%)后跟两位十六进制数,空格则编码为加号(+)。此编码与 WWW 表单 POST 数据的编码方式是一样的,同时与 application/x-www-form-urlencoded 的媒体类型编码方式一样
我就是研究不出来才到这里发帖问的

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

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

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov


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

Notepad++7.3.1
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use
