看板 PHP 關於我們 聯絡資訊
※ 引述《MapleWang8 (瘋子谷待太久.....)》之銘言: : : 推 bigair:file_get_contents, curl, preg_match 01/14 20:38 : 我能用file_get_contents或curl去捉取來源檔案了 : 可是捉回來的.htm檔 : 要如何分析 : 把<table>中間的第一欄、第二欄.....取出來呢? function get_between ($text, $s1, $s2) { $mid_url = ""; $pos_s = strpos($text,$s1); $pos_e = strpos($text,$s2); for ( $i=$pos_s+strlen($s1) ; ( ( $i < ($pos_e)) && $i < strlen($text) ) ; $i++ ) { $mid_url .= $text[$i]; } return $mid_url; } 好像是在 php.net 裡看到的~覺得滿好用的 我寫了個簡單的試範~ Demo URL: http://3wa.tw/demo/get_between.php -- 3WA訓練家的工作室 宗旨:諸葛單中,謝謝 個人佈弱格 網址:http://3wa.tw -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.240.83.12
mylucky:想請問為何我跑出來出現錯誤@@" 01/17 23:44
mylucky:Fatal error: Call to undefined function get_between() 01/17 23:44
mylucky: in C:\AppServ\www\test.php on line 3 01/17 23:44
MapleWang8:你沒有寫get_between這隻function 01/18 00:50