php函數記錄

查找字符串在另一字符串中第一次出現的位置

strpos() 函數

編碼轉換

iconv("utf-8","gb2312//IGNORE",$content);

xml轉換爲數組

/**
   * [getWeather 將xml轉換爲數組]
   * @param  string $xml [description]
   * @return [type]      [description]
   */
  function xml2arr($xml){
      $obj  = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
      $json = json_encode($obj);
      $arr  = json_decode($json, true);
      return $arr;
  }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章