简体   繁体   中英

Getting data from the PHP

Tell me how to get data from php file is located remotely. It throws a 400 Bad Request error on boot.

Here is the model:

Ext.define('MM.model.otprModel', {
extend : 'Ext.data.Model',
xtype : 'otprmodel',
config : {
    fields : [

    {
        name : 'id',
        type : 'string'
    }, {
        name : 'f1', // Номер заказа
        type : 'string'
    }, {
        name : 'f2',
        type : 'string'
    }, {
        name : 'f3',
        type : 'string'
    }, {
        name : 'f4',
        type : 'string'
    }, {
        name : 'f5',
        type : 'string'
    }, {
        name : 'f6',
        type : 'string'
    }, {
        name : 'f7',
        type : 'string'
    }, {
        name : 'f8',
        type : 'string'
    }, {
        name : 'f9',
        type : 'string'
    }, {
        name : 'f10',
        type : 'string'
    }, {
        name : 'f11',
        type : 'string'
    }, {
        name : 'f12',
        type : 'string'
    }, {
        name : 'f13',
        type : 'string'
    }, {
        name : 'f14', // Адрес
        type : 'string'
    }, {
        name : 'f15',
        type : 'string'
    }, {
        name : 'f16',
        type : 'string'
    }, {
        name : 'f17',
        type : 'string'
    }, {
        name : 'f18',
        type : 'string'
    }, {
        name : 'f19',
        type : 'string'
    }, {
        name : 'f20',
        type : 'string'
    }

    ]
},

fullName : function() {
    var d = this.data, names = [
    // d.firstName,
    (!d.f1 ? "" : d.f1 + "") // ,
    // d.adress
    ];
    return names.join(" ");
} });

Here's Store:

Ext.define('MM.store.otprStore', {
extend : 'Ext.data.Store',

config : {
    model : 'MM.model.otprModel',
    sorters : 'f1',
    grouper : {
        groupFn : function(record) {
            return record.get('f1')[0];
        }
    },
    proxy: {
                type: 'ajax',
                url: 'http://192.168.1.10/SOAP/test.php'
                },
                autoLoad: true,
                root: {
                    text:'Array'
                    }
                }
            });

Here is booted:

reloadButton : function(response, callback, scope) {
    Ext.getStore('otprStore').load();

}

I beg your pardon in advance only master. Thank you in advance for your answers.

If you look through browser it turns out this type of data:

Array(
[0] => Array
    (
        [id] => 2043175
        [mode] => cp
        [f1] => (2043175)
        [f2] => 2
        [f3] => 1
        [f4] => А-2 инжениринг
        [f11] => 0
        [f12] => 
        [f5] => пер. Загородный 3, 4/А-311
        [f6] => 1
        [f7] => 7.000
        [f8] => 0.008
        [f9] => по доверенности ММ
        [f10] => 017-208-36-33
        [f13] => Логвинович/Бадака
        [f14] => Барановичи, улица Бадака, д.68/Б
        [f15] => Барановичи
        [f16] => сигнализаторы
        [f17] => 290762695
        [f18] => 
        [f19] => 
        [f20] => 1
        [f21] => 
    )

Please tell me how to read the data. I myself can not understand.

了解如何在php http://www.php.net/manual/zh/function.json-encode.php中对数据进行json_encode。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM