ソースを参照

Merge branch 'master' of http://121.40.40.223:3000/wiipu/boniu

# Conflicts:
#	lib/sina.class.php
wanggangtao 5 年 前
コミット
ee5e46457d
共有1 個のファイルを変更した6 個の追加3 個の削除を含む
  1. 6 3
      lib/sina.class.php

+ 6 - 3
lib/sina.class.php

@@ -23,14 +23,17 @@ class Sina
         $content = curl_exec($curlHandle);
         curl_close($curlHandle);//防止中文乱码
         $content2 = iconv("gbk", "utf-8", $content);//子串
-        $content3 = substr($content2, strripos($content2, "=\"") + 2); //获取 var hq_str_sz000002="万 科A,30.780,30.800,30.510,  ="之后部分
-        $content3 = explode(",", $content3);//分割
-        return $content3;
+        $content3 = substr($content2, stripos($content2, "=\"") + 2); //获取 var hq_str_sz000002="万 科A,30.780,30.800,30.510,  ="之后部分
+        $content4 = substr($content3, 0, strripos($content3, "\";")); //获取     万 科A,30.94,0.14,0.45,584039,178827";         ";之前部分
+        $content5 = explode(",", $content4);//分割
+
+        return $content5;
     }
 
     //获取全部股票代码和名称列表
     static public function getAllStockCodeAndName()
     {
+        //循环遍历所有可能的股票代码,返回不为空,即可入库
         $url = "http://hq.sinajs.cn/list=s_sz000002";
         $content = self::curl_get_data($url);
         $data['code'] = '000002';