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;
  }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章