Heim > Fragen und Antworten > Hauptteil
Beim Debuggen eines PHP-Gets bitte
[code=php]<?php
$api = 'http://kj.kai861.com/view/pk10.html?1?10001?none? ';
$resource = file_get_contents( $api );
$data = json_decode( $resource , 1 );
$ct = $data['c_t'];
$cd = $data['c_d' ];
$cr = $data['c_r'];
header('Content-Type: text/xml;charset=utf8');
$limit=strlen($ct)-3;
$ ct=substr($ct,0,$limit).''.substr($ct,$limit,$limit+3);
Funktion tmp($v){
return 10>$v? "0{$v}":$v;
}
$cr=implode(',',array_map('tmp',array_slice(explode(',',$cr),0,20)));
echo '<xml>
<rowexpect="'.$ct.'" opencode="'.$cr.'" opentime="'.str_replace('/','-',$cd ).'"/>
</xml>';[/code]
Direkt öffnen http://kj.kai861.com/view/pk10.html?1?10001? Keine? Normal
Danke
小さな手は2018-06-24 15:30:29
API应该是这条:http://api.api68.com/pks/getLotteryPksInfo.do?lotCode=10001
小さな手は2018-06-24 15:28:02
不知道你要获取什么但是file_get_contents( $api );返回的是HTML不是JSON所以这个再json_decode肯定是错的