Upgrade to Pro — share decks privately, control downloads, hide ads and more …

一週完成英文學習網

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

 一週完成英文學習網

介紹 網站發想、製作、與探索的過程 (包含 成立原因、期程進度規劃表、等等)

Avatar for F2E桃園

F2E桃園

May 04, 2014
Tweet

More Decks by F2E桃園

Other Decks in Education

Transcript

  1. 列 需 求 、 建 資 料 庫 網 頁

    版 面 規 劃 建 置 文 章 拆 解 自 動 分 析 開 發 練 習 測 驗 模 式 開 發 會 員 複 習 功 能 導 入 各 平 台 A P I 功 能 測 試 正 式 開 放
  2. // 統整字串為小寫字母 strtolower(); ! ! // 讓迴圈用生命跑完所有文字吧 for、foreach、while(…){ ! preg_split

    + strpos + strlen => 截取關鍵字 ! } ! ! // 取得結果 $word_array => 目標文章處理後的單字陣列
  3. require 'facebook.php'; ! $facebook = new Facebook(array( ! 'appId' =>

    '程式ID', 'secret' => '此程式所對應的編碼' ! )); ! $fbid = $facebook->getUser();// Get User ID ! if ($fbid) { //登入成功 ! try { ! //查看已登入FB用戶的個人資料 $user_profile = $facebook->api('/me'); ! } catch (FacebookApiException $e) { ! $fbid = null; ! } ! }else { ! //登入失敗 … ! }
  4. class PorterStemming{ ! private static $xxxxx = xxx; private static

    $xxxxx = xxx; ! private static function step1($word){ … } private static function step2($word){ … } private static function step3($word){ … } } ! function ptr_s($word,…){ // 修正演算結果 $xxx = $database_pdo->original($word); if($xxx) return …; else if(strpos($word,'xxx')!==false) return substr(PorterStemming::xxx($word),0,-1). 'x'; else if(strpos($word,'xxx')===false&&strpos($word,'xx')===false) return $word ; else return PorterStemming::xxx($word); }
  5. $ch = curl_init(); ! $opt = array( CURLOPT_URL => '目標網址',

    CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_USERAGENT => 'Google Bot', CURLOPT_FOLLOWLOCATION => true, CURLOPT_REFERER => ‘`http://xx.xx.xx/xx.php' ); ! curl_setopt_array($ch, $opt); ! $web_contents = curl_exec($ch); ! curl_close($ch); ! ! /* 串接平台 api 回傳 JSON 格式 true 為回傳 array 格式 , false 回傳 object 格式 */ echo json_decode(web_contents,true); !
  6. ! ! ! ! ! ! ! ! ! $web

    = file_get_contents(“http://xx.xx.xx”); ! ! ! 王⼦子的筆記 輸入網址,一鍵完成翻譯及單字筆記功能。