头大啊,一个(-)符号搞得人要跪了,求大神帮下

a8849516 a8849516 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

接口发来的数据是没带(-)的,我这只能采集带(-)的,有什么办法能解决啊。

接口商提供的PHP演示能显示成这样,可是又没法采集


<?php header("Content-type: text/html; charset=utf-8"); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<meta http-equiv="refresh" content="5">
</head>
<body>
<?php
echo '<br>';
$src = 'http://f.apiplus.cn/cqssc.xml';
echo '<br>采集地址:'.$src.'<br>';
$src .= '?_='.time();
$xml = file_get_contents(urldecode($src));
$xml = simplexml_load_string($xml);

echo "<br>".date('Y-m-d H:i:s')."共采集到{$xml->attributes()->rows}行开奖数据:<br>";
for ($i = 0; $i < count($xml->row); $i++) {
$p = $xml ->row[$i]->attributes()->expect;
echo '<br>开奖期号:'.substr($p,0,8).'-'.substr($p,-3,3);
echo '<br>开奖号码:'.$xml ->row[$i]->attributes()->opencode;
echo '<br>开奖时间:'.$xml ->row[$i]->attributes()->opentime;
echo '<br>';
}
?>
</body>
</html>
...全文
评论 21
收藏 已收藏
分享
返回顶部
a8849516
基础编程 21,889 成员 140,329 内容