Home >Backend Development >PHP Tutorial >分享php代码将360浏览器导出的favdb的sqlite数据库文件转换为html_PHP

分享php代码将360浏览器导出的favdb的sqlite数据库文件转换为html_PHP

WBOY
WBOYOriginal
2016-05-28 13:13:06859browse

下面给大家分享了一段php代码,讲解将360浏览器导出的favdb的sqlite数据库文件转换为html,下面代码简单易懂,感兴趣的朋友看一下吧。

php代码如下所示:

<&#63;php
  $book_mark_name = 'book_mark.html';
  $content = file_get_contents('tb_fav.json');
  var_dump($content);
  $content_list = json_decode($content,'utf-8');
  $content_list = $content_list['RECORDS'];
  $content_header = "<!DOCTYPE NETSCAPE-Bookmark-file-1>".
   "<!-- This is an automatically generated file.It will be read and overwritten.Do Not Edit! -->".
   "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">".
   "<TITLE>Bookmarks</TITLE>".
   "<H1>Bookmarks</H1>".
   "<DL><p>";
  file_put_contents($book_mark_name,$content_header);
  foreach ($content_list as $item) {
    $href      = $item['url'];
    $add_date    = $item['create_time'];
    $last_visit   = $item['last_modify_time'];
    $last_modified = $item['last_modify_time']+1;
    $title     = $item['title'];
    $content = "<DT><A HREF=\"$href\" ADD_DATE=\"$add_date\" LAST_VISIT=\"$last_visit\" LAST_MODIFIED=\"$last_modified\" LOVEFAV=\"0\" FAV_POS=\"1\" >$title</A>"."<br/>";
    file_put_contents($book_mark_name,$content,FILE_APPEND);
  }
  $content_tail = "</DL><p>";
  file_put_contents($book_mark_name,$content_tail,FILE_APPEND);
  echo 'success';

以上php代码是小编给大家分享的将360浏览器导出的favdb的sqlite数据库文件转换为html的全部内容,希望大家喜欢。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn