【发布时间】:2012-10-10 16:04:53
【问题描述】:
在萤火虫中,在 POST 选项卡中,我看到以下内容;
JSON
textfieldone "Alex"
Source
{"textfieldone :"Alex"}
但在 PARAMS 选项卡中我看到了
_dc 1341332451114
当我 print_r($_REQUEST); 我得到时,在我的 PHP 代码中
Array
(
[_dc] => 1341332451114
)
而不是在 POST 选项卡中找到的 JSON。我该如何解决这个问题?
我不知道为什么会这样,我已经尝试调试了一整天
更新 PHP 代码:
<?php
// Make a MySQL Connection
mysql_connect("localhost", "root", "pwd") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
print_r($_REQUEST);
在萤火虫中,我在 url 下看到了上述响应;
POST http://localhost/proj/php/result.php?_dc=1341332451114 200 OK 107ms
我可以知道?_dc=1341366375982 是什么吗?我正在发送 POST
更新 2
EXT JS4 代码
型号
Ext.define ('Mycomp.model.MyClass',{
extend: 'Ext.data.Model',
fields:['textfieldone']
});
查看
Ext.define('Mycomp.view.user.MyClassView', {
extend: 'Ext.window.Window',
alias: 'widget.myclassview',
initComponent: function() {
this.items = [
{
xtype: 'form',
items: [
{
xtype: 'textfield',
name : 'textfieldone',
fieldLabel: 'Contact Person Name'
}
]
}
];
this.buttons = [
{
text: 'Save',
name:'save',
action: 'save'
}
];
this.callParent(arguments);
}
});
控制器
Ext.define('Mycomp.controller.MyClass',{
extend: 'Ext.app.Controller',
stores:['MyClass'],
models:['MyClass'],
views:['MyClassView'],
init: function(){
this.control({
'myclassview button[action=save]': {
click: this.myMethod
}
});
},
myMethod: function(button, record) {
var win = button.up('window'),
form = win.down('form'),
values = form.getValues(),
store = this.this.getmyClassStore(),
model = store.model,
record = model.create();
record.set( values );
store.add( record );
win.close();
store.sync();
}
});
商店
Ext.define('Mycomp.store.Myclass',{
extend:'Ext.data.Store',
model:'App.model.Myclass',
proxy: {
actionMethods : {
create : 'POST'
},
type: 'ajax',
url : '/savetodb.php'
}
});
【问题讨论】:
-
你确定它没有返回 404 吗?
-
我在上面添加了我的 PHP 代码。我没有得到 404
-
你是如何发送数据的,它们来自哪里?
-
发布您正在发送帖子数据的 javascript
-
还有什么是
print_r($_POST)?POST可能没有包含在REQUEST中?