开发者社区> 问答> 正文

请问一个简单的PHP知识,这里的代码哪里出错了啊?采集不到了? 400 报错

请问一个简单的PHP知识,这里的代码哪里出错了啊?采集不到了? 400 报错

<?php header('Content-Type:text/html; charset=utf-8'); if(date('Y-m-d H:i:s')>='2016-09-21 21:17:00') { echo "授权到期,如需续费,联系QQ:1615833313";exit; } else { echo "正常"; } require ("curl_http.php"); function trimall($str){ $qian=array("-"," "," ","\t","\n","\r");$hou=array("","","","","",""); return str_replace($qian,$hou,$str); } $curl = &new Curl_HTTP_Client(); $html_data = $curl->fetch_url("http://www.1395p.com/shishicai/"); $html_data=trimall($html_data); $mode="#<trclass='even'><td><pclass="p">(.?)</p><pclass="t">(.?)</p></td><tdclass="nums"><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.*?)</span></td>#";preg_match_all($mode,$html_data,$arr);$html_data1=$arr[0][0]; preg_match_all($mode,$html_data1,$arr1); echo "号码是:".$hm1=$arr1[3][0];echo $hm2=$arr1[4][0]; echo $hm3=$arr1[5][0]; echo $hm4=$arr1[6][0]; echo $hm5=$arr1[7][0]; $num1=$hm1; $num2=$hm2; $num3=$hm3; $num4=$hm4; $num5=$hm5; echo "期号是:".$arr1[1][0]; $qishu=$arr[1][0]; $time=date('Y-m-d')." ".$arr1[2][0]; echo "取出开奖时间:".$time; echo "如不对,请修改数据库"; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

展开
收起
爱吃鱼的程序员 2020-06-03 14:41:53 495 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    首先 进不到if里面去 第二 php页面写html代码需要echo 第三 html代码需要用单引号或者双引号引起来
    ######

    <?php header('Content-Type:text/html; charset=utf-8'); if (date('Y-m-d H:i:s') >= '2016-09-21 21:17:00') { echo "授权到期,如需续费,联系QQ:1615833313"; exit; } else { echo "正常"; } //require ("curl_http.php");

    function trimall($str) { $qian = array("-", " ", " ", "\t", "\n", "\r"); $hou = array("", "", "", "", "", ""); return str_replace($qian, $hou, $str); }

    //$curl = &new Curl_HTTP_Client(); //$html_data = $curl->fetch_url("http://www.1395p.com/shishicai/"); $html_data = file_get_contents("http://www.1395p.com/shishicai/"); $html_data = trimall($html_data); $mode = "#<trclass='even'><td><pclass="p">(.?)</p><pclass="t">(.?)</p></td><tdclass="nums"><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.*?)</span></td>#"; preg_match_all($mode, $html_data, $arr); $html_data1 = $arr[0][0]; preg_match_all($mode, $html_data1, $arr1); echo "号码是:" . $hm1 = $arr1[3][0]; echo $hm2 = $arr1[4][0]; echo $hm3 = $arr1[5][0]; echo $hm4 = $arr1[6][0]; echo $hm5 = $arr1[7][0]; $num1 = $hm1; $num2 = $hm2; $num3 = $hm3; $num4 = $hm4; $num5 = $hm5; echo "期号是:" . $arr1[1][0]; $qishu = $arr[1][0]; $time = date('Y-m-d') . " " . $arr1[2][0]; echo "取出开奖时间:" . $time; echo "如不对,请修改数据库"; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">



    2020-06-03 16:40:14
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
PHP安全开发:从白帽角度做安全 立即下载
PHP 2017.北京 全球开发者大会——高可用的PHP 立即下载
复杂PHP系统性能瓶颈排查及优化 立即下载