TYPE 使用jsonp
sencha store
Ext.define('Sencha.store.IndexListST', { extend: 'Ext.data.Store', //继承 config: { fields: ['range','ar_id','pic', 'title','date'], autoLoad: true, proxy: { type: 'jsonp', url: 'http://192.168.1.199/duduke/json/1.php?type=index_list', reader: { type: 'json' } } } });
服务器端
<?PHP $type = $_REQUEST['type']; $pi = 'http://www.sencha.com/assets/images/sencha-avatar-64x64.png'; $callback = $_REQUEST['callback']; $ar = array(); $ar[] = array('range'=>'1','ar_id'=>'332','pic'=>$pi,'title'=>'werasf asdfasd dsf','date'=>'2012-3-5'); $ar[] = array('range'=>'2','ar_id'=>'331','pic'=>$pi,'title'=>'test123','date'=>'2012-3-5'); $ar[] = array('range'=>'3','ar_id'=>'442','pic'=>$pi,'title'=>'test123','date'=>'2012-3-5'); header('Content-Type: text/javascript'); echo $callback . '(' . json_encode($ar) . ');';