$stock_string="http://hq.sinajs.cn/list=sh601006";
echo file_get_contents($stock_string);
?>
取得產出:
var hq_str_sh601006="大秦鐵路,6.100,6.120,6.110,6.140,6.090,6.100,6.110,20493711,125311065.06. 1065300,6.080,596400,6.070,912000,6.060, 122486,6.110,1106900,6.120,1318700,6.130,1221000,6.140,1334900,6.150,2016-08-05,15:00:00,000php";鐵路,6.100,6.120,6.110,6.140,6.090,6.100,6.110,20493711,125311065.000,894866,6.100,986200,6.090,1065300,6.080,596400,6.070,912000,6.060,122486,6.110,1106900,6.120,1318700, 6.130,1221000,6.140,1334900,6.150,2016-08-05,15:00:00,00"
2.用一個陣列來裝這個字串?
回覆內容:
?>
取得產出:
var hq_str_sh601006="大秦鐵路,6.100,6.120,6.110,6.140,6.090,6.100,6.110,20493711,125311065.06. 1065300,6.080,596400,6.070,912000,6.060, 122486,6.110,1106900,6.120,1318700,6.130,1221000,6.140,1334900,6.150,2016-08-05,15:00:00,000php";鐵路,6.100,6.120,6.110,6.140,6.090,6.100,6.110,20493711,125311065.000,894866,6.100,986200,6.090,1065300,6.080,596400,6.070,912000,6.060,122486,6.110,1106900,6.120,1318700, 6.130,1221000,6.140,1334900,6.150,2016-08-05,15:00:00,00"
這是取得到JS程式碼,你可以試試
$stock_string="http://hq.sinajs.cn/list=sh601006";
?> ?<script><p><php echo $str? ></script>
console.log(hq_str_sh601006);//TODO 處理資料